var i;
Object.defineProperty(exports, "__esModule", {
  value: true
});
var UI_Bag_UIBindings = require("AA_UI_Bag_UIBindings");
var UIView = require("AA_UIView");
var Item_GameEquip = require("AA_Item_GameEquip");
var Item_GameBagCell = require("AA_Item_GameBagCell");
var GameDataManager = require("AA_GameDataManager");
var Item_CellFatherMove = require("AA_Item_CellFatherMove");
var Excel = require("AA_Excel");
var Logic_GetEquip = require("AA_Logic_GetEquip");
var LogManager = require("AA_LogManager");
var EventManager = require("AA_EventManager");
var EvenType = require("AA_EvenType");
var TipsManager = require("AA_TipsManager");
var ADManager = require("AA_ADManager");
var UIManager = require("AA_UIManager");
var BundleConfig = require("AA_BundleConfig");
var UIConfig_Game = require("AA_UIConfig_Game");
var Const_Game = require("AA_Const_Game");
var BuffMag = require("AA_BuffMag");
var PlayerDataManager = require("AA_PlayerDataManager");
var Const_Common = require("AA_Const_Common");
var GuideControl = require("AA_GuideControl");
var AudioManager = require("AA_AudioManager");
var Item_PaiZi = require("AA_Item_PaiZi");
var GameGlobalVariable = require("AA_GameGlobalVariable");
var AIControl = require("AA_AIControl");
var UIConfig_Common = require("AA_UIConfig_Common");
var LineTipControl = require("AA_LineTipControl");
var CPBuffControl = require("AA_CPBuffControl");
var _decorator = cc._decorator;
var _ccclass = _decorator.ccclass;
var _property = _decorator.property;

var _def_UI_Bag = function (t) {
  function _creator() {
    var e = null !== t && t.apply(this, arguments) || this;
    e.auto_ui = null;
    e.paiZiPfb = null;
    e.lineTipControl = null;
    e.cpBuffControl = null;
    e.maxX = 5;
    e.maxY = 7;
    e.startX = 3;
    e.startY = 3;
    e.effectMax = 60;
    e.oneBuyMoney = 15;
    e.videoGetMoney = 30;
    e.xifuTime = .15;
    e.moveTime = .22;
    e.viewNodePosY = 100;
    e.lastPickArray = [];
    e.cellCompMap = new Map();
    e.equipPool = new Map();
    e.dressUpEquipMap = new Map();
    e.baseCellCompArray = [];
    e.currAddCellDataMap = new Map();
    e.selfMap = {};
    e.firstUseArray = [];
    e.currZanCunChuEquip = null;
    e.videoResetTime = 0;
    e.changeFuritID = -1;
    e.childPosMap = new Map();
    e.currPickNode = null;
    e.moveLength = 0;
    e.showTipCd = false;
    e.guide4Time = -1;
    e.isShow8_1 = false;
    e.isUpBuffCdTime = false;
    e.upBuffArray = [];
    e.jianTouArray = [];
    e.mustResetTime = -1;
    return e;
  }
  __extends(_creator, t);
  _creator.prototype._show = function (e) {
    var t = [];
    for (var o = 1; o < arguments.length; o++) {
      t[o - 1] = arguments[o];
    }
    Logic_GetEquip.default.I.ResetThis();
  };
  _creator.prototype.GameOpenMoveTween = function (e, t) {
    var o = e ? this.viewNodePosY : 0;
    this.auto_ui.node_viewNode.y = o;
    t && t();
  };
  _creator.prototype.start = function () {
    var e = this;
    this.scheduleOnce(function () {
      LogManager.LogMgr.debug(e.node.height);
      if (cc.winSize.height / cc.winSize.width > 2) {
        e.auto_ui.node_DragFather.y = -540;
      } else {
        e.auto_ui.node_DragFather.y = -500;
      }
    });
  };
  _creator.prototype._addEventListener = function () {
    this._addEvent(EvenType.EVENT_TYPE.ResetGameBagAI, this.AICheck, this);
    this._addEvent(EvenType.EVENT_TYPE.Game_Show_AddMoneyView, this.OpenAddMoneyView, this);
  };
  _creator.prototype.OpenView = function (e) {
    var t = this;
    this.videoResetTime = 0;
    this.auto_ui.btn_VideoResetBtn.node.active = true;
    this.GameOpenMoveTween(true, function () {
      t.scheduleOnce(function () {
        t.CheckBottomBtnScale();
      }, .15);
      if (e && e.isGameEnd) {
        if (PlayerDataManager.PlayerDataMgr.GetGuideIndexByTaskName(Const_Common.GuideName.战斗背包) == Const_Common.GameBagGuideIndex.引导词条7完结) {
          PlayerDataManager.PlayerDataMgr.SetGuideIndex(Const_Common.GuideName.战斗背包, Const_Common.GameBagGuideIndex.引导格子8);
        } else {
          t.scheduleOnce(function () {
            t.AICheck();
          }, AIControl.default._instance.fightDelayTime);
        }
        if (BuffMag.BuffMgr.erjiShuiGuoBuff()) {
          LogManager.LogMgr.debug("有二级必得buff，必出二级水果");
          t.ResetEquip(true, true, true);
        } else {
          t.ResetEquip(true, false, true);
        }
        t.CheckGuide();
        t.scheduleOnce(function () {
          t.dressUpEquipMap.forEach(function (e) {
            if (1002 == e.equipData.shuiguoId) {
              var t = BuffMag.BuffMgr.getShuiGuoBuff(1002, e.equipData.equipLevel);
              EventManager.EventMgr.dispatchEvent(EvenType.EVENT_TYPE.Game_Add_YinBi, t.nowvalue, e.node.convertToWorldSpaceAR(cc.v2(0, 0)));
            }
          });
        }, .5);
      }
    });
  };
  _creator.prototype.onEnable = function () {
    var e = this;
    this.ChangeSliderLabelColor();
    this.auto_ui.btn_zanCunChuBtn.node.active = false;
    if (GameGlobalVariable.GameGlobalVariable.nowlevel > 1 || 1 == GameGlobalVariable.GameGlobalVariable.isTeShuLevel()) {
      var t = .02;
      GameDataManager.GameDataMgr.gameBag || (t = .5);
      this.scheduleOnce(function () {
        GameDataManager.GameDataMgr.gameBag.zanCunUnLockBoShu = 1;
        if (GameDataManager.GameDataMgr.gameBag.zanCunEquipData) {
          var t = GameDataManager.GameDataMgr.gameBag.zanCunEquipData;
          var o = e.GetEquipNode(t.pfbName);
          o.parent = e.auto_ui.node_zanCunEquipFather;
          var n = o.width > o.height ? 100 / o.width : 100 / o.height;
          n = n > 1 ? 1 : n;
          o.scale = n;
          o.setPosition(0, 50);
          o.active = true;
          var i = o.getComponent(Item_GameEquip.default);
          var a = -1 == t.equipLevel;
          i.StartSet(t, a, e.onChildTouchStart.bind(e), e.onChildTouchMove.bind(e), e.onChildTouchUp.bind(e), e.MakePaiZi.bind(e));
          i.DragEndLockCell(null);
          e.currZanCunChuEquip = i;
        }
        e.auto_ui.node_zanCunChuIcon.active = -1 == GameDataManager.GameDataMgr.gameBag.zanCunUnLockBoShu;
        e.auto_ui.btn_zanCunChuBtn.interactable = e.auto_ui.node_zanCunChuIcon.active;
        e.auto_ui.btn_zanCunChuBtn.node.active = true;
      }, t);
    }
  };
  _creator.prototype.ChangeSliderLabelColor = function () {
    var e = GameDataManager.GameDataMgr.sliderCoin;
    this.auto_ui.node_sliverLabelNode.color = e >= this.oneBuyMoney ? cc.Color.WHITE : cc.Color.RED;
  };
  _creator.prototype.onLoad = function () {
    var e = this;
    this.init("", "", null);
    console.log('this.auto_ui.dbAnim_heChengEffect = ', this.auto_ui.dbAnim_heChengEffect.addEventListener);
    this.auto_ui.dbAnim_heChengEffect.addEventListener(dragonBones.EventObject.COMPLETE, function () {
      e.auto_ui.dbAnim_heChengEffect.node.active = false;
    }, this);
    this._loadRes(BundleConfig.BundleNames.Game, "game/" + "res/bg/gezibg" + GameGlobalVariable.GameGlobalVariable.getSceneId(), cc.SpriteFrame).then(function (t) {
      e.auto_ui.node_diTuNode.getComponent(cc.Sprite).spriteFrame = t;
    });
    this.auto_ui.btn_VideoGetCell.node.active = false;
    PlayerDataManager.PlayerDataMgr.GetGuideIndexByTaskName(Const_Common.GuideName.战斗背包) == Const_Common.GameBagGuideIndex.引导完结 && (this.auto_ui.btn_VideoGetCell.node.active = this.maxX * this.maxY - this.cellCompMap.size > 0 && GameDataManager.GameDataMgr.gameBag.videoCellCount < GameGlobalVariable.GameGlobalVariable.bagVideoCellCount);
    this.GameOpenMoveTween(true, function () {
      e.StartSet();
      e.scheduleOnce(function () {
        e.CheckBottomBtnScale();
      }, .15);
    });
  };
  _creator.prototype.StartSet = function () {
    var e = this;
    this.auto_ui.btn_UseGeZiBtn.node.active = false;
    this.auto_ui.node_useGeZiTip.active = false;
    this.cellFatherMove = this.auto_ui.node_DragEndNode.getComponent(Item_CellFatherMove.default);
    this.cellFatherMove.StartSet(this);
    for (var t = this.auto_ui.node_DragFather.childrenCount - 1; t >= 0; t--) {
      this.RecycleEquip(this.auto_ui.node_DragFather.children[t]);
    }
    var o = false;
    if (!GameDataManager.GameDataMgr.gameBag.bagArray) {
      Logic_GetEquip.default.I.ResetSetCellList();
      GameDataManager.GameDataMgr.gameBag.bagArray = [];
      o = true;
      var n = (this.maxX - this.startX) / 2;
      var i = (this.maxY - this.startY) / 2;
      var a = Math.floor(n);
      var r = Math.ceil(n);
      var c = Math.floor(i);
      var s = Math.ceil(i);
      for (var u = 0; u < this.maxY; u++) {
        for (var h = 0; h < this.maxX; h++) {
          var g = 0;
          (h < a || h >= this.maxX - r || u < c || u >= this.maxY - s) && (g = -1);
          GameDataManager.GameDataMgr.gameBag.bagArray.push(g);
        }
      }
    }
    var _ = this.auto_ui.node_cubeFather;
    if (0 == _.childrenCount) {
      this.auto_ui.node_diTuNode.active = true;
      var m = this.auto_ui.node_cubeBaseFather;
      for (t = 0; t < this.maxX * this.maxY; t++) {
        var y = undefined;
        if (t < m.childrenCount) {
          y = m.children[t];
        } else {
          (y = cc.instantiate(this.auto_ui.node_cubeItem)).parent = m;
        }
        y.active = true;
        (b = y.getComponent(Item_GameBagCell.default)).StartSet({
          cellIndex: t
        }, false);
        b.TempShow(true);
        this.baseCellCompArray.push(b);
      }
      m.opacity = 0;
      this.cellCompMap.clear();
      for (u = 0; u < this.maxY; u++) {
        for (h = 0; h < this.maxX; h++) {
          var v = u * this.maxX + h;
          if (-1 != (g = GameDataManager.GameDataMgr.gameBag.bagArray[v])) {
            var b = (y = cc.instantiate(this.auto_ui.node_cubeItem)).getComponent(Item_GameBagCell.default);
            this.cellCompMap.set(v, b);
            y.name = "方块" + v;
            y.parent = _;
            y.active = true;
            b.StartSet({
              cellIndex: v
            }, -1 != g);
          }
        }
      }
      this.scheduleOnce(function () {
        e.cellCompMap.forEach(function (e) {
          e.node.setPosition(_.convertToNodeSpaceAR(m.children[e.cellData.cellIndex].convertToWorldSpaceAR(cc.v2(0, 0))));
        });
        var t = cc.v2(44, 32);
        e.ChangeSizeByChild(e.auto_ui.node_cubeFather, t);
        e.SetBgNodeSize(false);
      });
    }
    this.StartShowEquip(o);
    GameDataManager.GameDataMgr.gameBag.cellWposArray && 0 != GameDataManager.GameDataMgr.gameBag.cellWposArray.length || this.SaveCellWpos();
    PlayerDataManager.PlayerDataMgr.GetGuideIndexByTaskName(Const_Common.GuideName.战斗背包) == Const_Common.GameBagGuideIndex.引导词条7完结 && PlayerDataManager.PlayerDataMgr.GMSetGuideIndex(Const_Common.GuideName.战斗背包, Const_Common.GameBagGuideIndex.引导开战6);
    if (PlayerDataManager.PlayerDataMgr.GetGuideIndexByTaskName(Const_Common.GuideName.战斗背包) != Const_Common.GameBagGuideIndex.引导完结) {
      this.CheckGuide();
    } else {
      this.scheduleOnce(function () {
        e.AICheck();
      });
    }
  };
  _creator.prototype.StartShowEquip = function (e) {
    var t = this;
    var o = this;
    this.dressUpEquipMap.clear();
    this.equipPool.clear();
    var n = GameDataManager.GameDataMgr.gameBag;
    if (n.dressUpEquips) {
      var i = [];
      var a = [];
      var r = [];
      n.dressUpEquips.forEach(function (e) {
        var o = t.GetEquipNode(e.pfbName);
        o.parent = t.auto_ui.node_DragEndNode;
        o.active = true;
        i.push(e.wPostion);
        a.push(o);
        r.push(e.selfPos);
        var n = o.getComponent(Item_GameEquip.default);
        var c = -1 == e.equipLevel;
        n.StartSet(e, c, t.onChildTouchStart.bind(t), t.onChildTouchMove.bind(t), t.onChildTouchUp.bind(t), t.MakePaiZi.bind(t));
        t.dressUpEquipMap.set(o.uuid, n);
        var s = [];
        e.lockCellIndex.forEach(function (e) {
          t.cellCompMap.get(e).DragEndLockThis(n);
          s.push(t.cellCompMap.get(e));
        });
        n.DragEndLockCell(s);
      });
      this.scheduleOnce(function () {
        i.forEach(function (e, t) {
          var n = a[t].parent.convertToNodeSpaceAR(e);
          r[t] && (n = r[t]);
          a[t].setPosition(cc.v2(n.x, n.y + o.viewNodePosY));
        });
        t.dressUpEquipMap && t.dressUpEquipMap.forEach(function (e) {
          e.equipData && e.equipData.selfPos && (e.equipData.wPostion = e.node.parent.convertToWorldSpace(e.equipData.selfPos));
        });
      });
    }
    if (n.equipPool && n.equipPool.length > 0) {
      n.equipPool.forEach(function (e) {
        var o = t.GetEquipNode(e.pfbName);
        o.parent = t.auto_ui.node_DragFather;
        o.active = true;
        o.setPosition(0, 0);
        var n = o.getComponent(Item_GameEquip.default);
        var i = -1 == e.equipLevel;
        n.StartSet(e, i, t.onChildTouchStart.bind(t), t.onChildTouchMove.bind(t), t.onChildTouchUp.bind(t), t.MakePaiZi.bind(t));
        t.equipPool.set(n.node.uuid, n);
      });
    } else {
      e && this.ResetEquip(true, false, true);
    }
    this.CheckDragFatherLayout();
  };
  _creator.prototype.SliderResetClick = function () {
    if (GameDataManager.GameDataMgr.sliderCoin >= this.oneBuyMoney) {
      this.ResetEquip(false, false, false);
    } else {
      this.OpenAddMoneyView();
    }
  };
  _creator.prototype.OpenAddMoneyView = function (e) {
    var t = this;
    undefined === e && (e = null);
    var o = this;
    var n = new Const_Game.VideoBuyOneData();
    n.titleStr = e || "银币不足";
    n.coinCount = this.videoGetMoney;
    n.infoStr = "是否观看视频，获得" + this.videoGetMoney + "银币";
    n.clickCallBack = function () {
      GameDataManager.GameDataMgr.AddSliderCoin(t.videoGetMoney);
      o.ChangeSliderLabelColor();
      EventManager.EventMgr.dispatchEvent(EvenType.EVENT_TYPE.Game_Add_YinBi, t.videoGetMoney, t.node.convertToWorldSpaceAR(cc.v2(0, 0)), null, false);
    };
    UIManager.default.open(BundleConfig.BundleNames.Game, UIConfig_Game.UIView_Game.UI_VideoBuyOne, n);
  };
  _creator.prototype._clickListener = function (e) {
    var t = this;
    if (!this.currPickNode || GameGlobalVariable.GameGlobalVariable.isZhanChunBug) {
      var o = this.auto_ui;
      switch (e) {
        case o.btn_ResetBtn:
          this.SliderResetClick();
          break;
        case o.btn_VideoResetBtn:
          var n = "背包视频刷新";
          if (1 == GameGlobalVariable.GameGlobalVariable.isTeShuLevel()) {
            n = "无尽模式背包视频刷新";
          } else {
            var i = GameDataManager.GameDataMgr.getNowLevelBoshuState(GameGlobalVariable.GameGlobalVariable.nowlevel, 2) + 1;
            n = GameGlobalVariable.GameGlobalVariable.nowlevel + "章_" + i + "波_" + n;
          }
          ADManager.ADMgr.showRewardedVideo(n, function () {
            t.ResetEquip(false, true, false);
            t.videoResetTime++;
            o.btn_VideoResetBtn.node.active = t.videoResetTime < GameGlobalVariable.GameGlobalVariable.bagVideoResetCount;
            t.CheckBottomBtnScale();
          });
          break;
        case o.btn_start:
          if (this.currPickNode) {
            return;
          }
          this.GameStart();
          break;
        case o.btn_UseGeZiBtn:
          this.SetCellFatherMove(false);
          break;
        case o.btn_VideoGetCell:
          this.VideoGetCell();
          break;
        case o.btn_zanCunChuBtn:
          o.node_zanCunChuIcon.active && this.VideoGetZanCunChu();
      }
    }
  };
  _creator.prototype.VideoGetZanCunChu = function () { };
  _creator.prototype.VideoGetCell = function () {
    var e = this;
    var t = "背包视频获取扩展格子";
    if (1 == GameGlobalVariable.GameGlobalVariable.isTeShuLevel()) {
      t = "无尽模式背包视频获取扩展格子";
    } else {
      var o = GameDataManager.GameDataMgr.getNowLevelBoshuState(GameGlobalVariable.GameGlobalVariable.nowlevel, 2) + 1;
      t = GameGlobalVariable.GameGlobalVariable.nowlevel + "章_" + o + "波_" + t;
    }
    ADManager.ADMgr.showRewardedVideo(t, function () {
      var t = GameGlobalVariable.GameGlobalVariable.bagVideoCellCount;
      GameDataManager.GameDataMgr.gameBag.videoCellCount++;
      var o = "" + (t - GameDataManager.GameDataMgr.gameBag.videoCellCount);
      e.auto_ui.node_videoLastCount.children.forEach(function (e) {
        e.active = e.name == o;
      });
      e.auto_ui.btn_VideoGetCell.node.active = e.maxX * e.maxY - e.cellCompMap.size > 0 && GameDataManager.GameDataMgr.gameBag.videoCellCount < t;
      GameDataManager.GameDataMgr.SaveGameBagData();
      e.CheckBottomBtnScale();
      var n = Logic_GetEquip.default.I.GetOneCell(1, e.maxX * e.maxY - e.cellCompMap.size, GameDataManager.GameDataMgr.gameBag.videoCellCount);
      GameDataManager.GameDataMgr.gameBag.videoCellCount >= t && Logic_GetEquip.default.I.ResetSetCellList();
      for (var i = 0; i < n.length; i++) {
        var a = n[i];
        if (a) {
          var r = e.GetEquipNode(a.pfbName);
          if (!r) {
            continue;
          }
          r.parent = e.auto_ui.node_DragFather;
          e.auto_ui.node_DragFather.childrenCount > 1 && r.setSiblingIndex(Math.floor(e.auto_ui.node_DragFather.childrenCount / 2));
          r.active = true;
          var c = r.getComponent(Item_GameEquip.default);
          var s = -1 == a.level;
          var l = s ? a.level : a.level - 1;
          var p = {
            shuiguoId: a.shuiguoId,
            equipLevel: l,
            lockCellIndex: [],
            pfbName: a.pfbName,
            isHaveQiPao: 1 == a.isHaveQiPao
          };
          c.StartSet(p, s, e.onChildTouchStart.bind(e), e.onChildTouchMove.bind(e), e.onChildTouchUp.bind(e), e.MakePaiZi.bind(e));
          e.AddEquipPoolData(c);
        }
      }
      AudioManager.AudioMgr.playEffect("game/sound/resetEquip", false, BundleConfig.BundleNames.Game);
    });
  };
  _creator.prototype.GameStart = function () {
    if (this.dressUpEquipMap.size > 0) {
      if (GameDataManager.GameDataMgr.gameBag.zanCunEquipData) {
        var e = this;
        var t = new Const_Common.EventViewOpenData();
        t.tipStr = "存放处中还有水果，开战后不保留，确定要开战吗？";
        t.btnStrs = ["确定", "取消"];
        t.btnTypes = [0, 1];
        t.clickFuncs = [function () {
          e.OnGameStart();
        }, null];
        UIManager.default.open(BundleConfig.BundleNames.Common, UIConfig_Common.UIView_Common.UI_EventView, t);
      } else {
        this.OnGameStart();
      }
    } else {
      TipsManager.TipMgr.showToast("请先上阵水果");
    }
  };
  _creator.prototype.OnGameStart = function () {
    EventManager.EventMgr.dispatchEvent(EvenType.EVENT_TYPE.Game_OpenGame);
    GameDataManager.GameDataMgr.gameBag.equipPool.length = 0;
    for (var e = this.auto_ui.node_DragFather.childrenCount - 1; e >= 0; e--) {
      this.RecycleEquip(this.auto_ui.node_DragFather.children[e]);
    }
    this.GameOpenMoveTween(false, null);
    GameDataManager.GameDataMgr.gameBag.zanCunEquipData = null;
    this.currZanCunChuEquip = null;
    this.auto_ui.node_zanCunEquipFather.destroyAllChildren();
    this.auto_ui.btn_zanCunChuBtn.node.active = false;
  };
  _creator.prototype.ResetEquip = function (e, t, o) {
    if (!e && !t) {
      if (!GameDataManager.GameDataMgr.SubSliderCoin(this.oneBuyMoney)) {
        return;
      }
      this.ChangeSliderLabelColor();
    }
    this.MakeEquip(t ? 4 : 3, t, o);
    this.SaveData();
    this.CheckDragFatherLayout();
  };
  _creator.prototype.MakeEquip = function (e, t, o) {
    AudioManager.AudioMgr.playEffect("game/sound/resetEquip", false, BundleConfig.BundleNames.Game);
    var n = GameDataManager.GameDataMgr.getNowLevelBoshuState(GameGlobalVariable.GameGlobalVariable.nowlevel, 2) + 1;
    1 != GameGlobalVariable.GameGlobalVariable.isTeShuLevel() && o || (n = 2);
    var i = Logic_GetEquip.default.I.GetIsGuDingData();
    var a = Logic_GetEquip.default.I.GetEquip(e, t, this.maxX * this.maxY - this.cellCompMap.size, n);
    if (1 == n && o && !i) {
      var r = undefined;
      for (var c = 0; c < a.length; c++) {
        if (1 == (s = a[c]).level && s.shuiguoId != Const_Game.FruitId.杨桃忍者 && s.shuiguoId != Const_Game.FruitId.柠檬精 && s.shuiguoId != Const_Game.FruitId.辣妹子 && s.shuiguoId != Const_Game.FruitId.招财橙子) {
          r = s;
          break;
        }
      }
      if (r) {
        for (c = 0; c < a.length; c++) {
          var s;
          if (1 == (s = a[c]).level && s.shuiguoId != r.shuiguoId) {
            a[c] = r;
            break;
          }
        }
      }
    }
    if (PlayerDataManager.PlayerDataMgr.GetGuideIndexByTaskName(Const_Common.GuideName.战斗背包) == Const_Common.GameBagGuideIndex.引导初始1) {
      a = [Excel.Excel.bagEquipRule(14), Excel.Excel.bagEquipRule(32), Excel.Excel.bagEquipRule(12)];
    } else if (PlayerDataManager.PlayerDataMgr.GetGuideIndexByTaskName(Const_Common.GuideName.战斗背包) == Const_Common.GameBagGuideIndex.引导刷新按钮3) {
      a = [Excel.Excel.bagEquipRule(14), Excel.Excel.bagEquipRule(32), Excel.Excel.bagEquipRule(10)];
    } else {
      PlayerDataManager.PlayerDataMgr.GetGuideIndexByTaskName(Const_Common.GuideName.战斗背包) == Const_Common.GameBagGuideIndex.引导格子8 && (a = [Excel.Excel.bagEquipRule(2), Excel.Excel.bagEquipRule(30), Excel.Excel.bagEquipRule(10)]);
    }
    if (o && this.maxX * this.maxY - this.cellCompMap.size > 0 && !i) {
      var l = Logic_GetEquip.default.I.GetMustGetGeZi();
      l && (a[Math.floor(Math.random() * a.length)] = l);
    }
    if (2 == GameGlobalVariable.GameGlobalVariable.nowlevel && 10 == n && o) {
      a[Math.floor(Math.random() * a.length)] = Excel.Excel.bagEquipRule(46);
    } else {
      2 == GameGlobalVariable.GameGlobalVariable.nowlevel && 11 == n && o && (a[Math.floor(Math.random() * a.length)] = Excel.Excel.bagEquipRule(38));
    }
    for (c = this.auto_ui.node_DragFather.childrenCount - 1; c >= 0; c--) {
      this.RecycleEquip(this.auto_ui.node_DragFather.children[c]);
    }
    this.equipPool.clear();
    GameDataManager.GameDataMgr.gameBag.equipPool = [];
    for (c = 0; c < e; c++) {
      var p = a[c];
      var g = this.GetEquipNode(p.pfbName);
      if (g) {
        g.parent = this.auto_ui.node_DragFather;
        g.active = true;
        var _ = g.getComponent(Item_GameEquip.default);
        var m = -1 == p.level;
        var y = m ? p.level : p.level - 1;
        var v = {
          shuiguoId: p.shuiguoId,
          equipLevel: y,
          lockCellIndex: [],
          pfbName: p.pfbName,
          isHaveQiPao: 1 == p.isHaveQiPao
        };
        _.StartSet(v, m, this.onChildTouchStart.bind(this), this.onChildTouchMove.bind(this), this.onChildTouchUp.bind(this), this.MakePaiZi.bind(this));
        this.AddEquipPoolData(_);
      }
    }
    this.childPosMap.clear();
  };
  _creator.prototype.onChildTouchStart = function (e) {
    if (!this.currPickNode) {
      var t = e.target.parent.parent;
      this.SetTouchStartNode(t);
    }
  };
  _creator.prototype.SetTouchStartNode = function (e) {
    this.childPosMap.set(e.uuid, e.getPosition());
    this.currPickNode = e;
    this.currPickNodeComp = e.getComponent(Item_GameEquip.default);
    if (this.currPickNode.parent.uuid == this.auto_ui.node_zanCunEquipFather.uuid) {
      GameDataManager.GameDataMgr.gameBag.zanCunEquipData = null;
      this.currZanCunChuEquip = null;
      this.AddEquipPoolData(this.currPickNodeComp);
    }
    var t = this.currPickNode.convertToWorldSpaceAR(cc.v2(0, 0));
    this.currPickNode.parent = this.auto_ui.node_DragTempNode;
    this.currPickNode.setPosition(this.auto_ui.node_DragTempNode.convertToNodeSpaceAR(t));
    if (this.currPickNode.scale < 1) {
      this.currPickNode.runAction(cc.scaleTo(.25, 1, 1));
      GameDataManager.GameDataMgr.gameBag.zanCunEquipData = null;
      this.currZanCunChuEquip = null;
    }
    this.currPickNodeComp.isGeZiType && this.SetCellFatherMove(true);
    this.currPickNode.angle = 0;
    this.moveLength = 0;
    -1 == this.guide4Time && PlayerDataManager.PlayerDataMgr.GetGuideIndexByTaskName(Const_Common.GuideName.战斗背包) != Const_Common.GameBagGuideIndex.引导格子8 || !this.guideShou || (this.guideShou.active = false);
    this.currPickNodeComp.lockCellArray && 0 != this.currPickNodeComp.lockCellArray.length || this.CheckDragFatherLayout(this.currPickNode.uuid, -1);
    AudioManager.AudioMgr.playEffect("audio/effect/dianEquip");
    this.currPickNodeComp && this.currPickNodeComp.equipData.equipLevel == GameGlobalVariable.GameGlobalVariable.normalMaxLevel - 1 && EventManager.EventMgr.dispatchEvent(EvenType.EVENT_TYPE.Game_Show_Level5Tip, {
      isShow: true,
      shuiGuoId: this.currPickNodeComp.equipData.shuiguoId
    });
    this.currPickNodeComp.ShowUnLock5Tip(true, this.equipPool, this.dressUpEquipMap);
    this.lineTipControl.HideOne(this.currPickNode);
  };
  _creator.prototype.onChildTouchMove = function (e) {
    if (this.currPickNode) {
      var t = this.currPickNode.parent.convertToNodeSpaceAR(e.getLocation());
      this.currPickNode.setPosition(t);
      if (Math.abs(e.getDeltaX()) + Math.abs(e.getDeltaY()) > 3) {
        var o = this.CheckCellIsOk(false);
        this.moveLength += Math.abs(e.getDeltaX()) + Math.abs(e.getDeltaY());
        if (this.currPickNodeComp.equipData.shuiguoId == Const_Game.FruitId.柠檬精 || this.currPickNodeComp.equipData.shuiguoId == Const_Game.FruitId.辣妹子 || this.currPickNodeComp.equipData.shuiguoId == Const_Game.FruitId.紫薯精) {
          if (o.pickCellArray) {
            var n = [];
            o.pickCellArray.forEach(function (e) {
              n.push(e.cellData.cellIndex);
            });
            if (this.currPickNodeComp.equipData.shuiguoId == Const_Game.FruitId.柠檬精) {
              this.CheckUpBuff(n, false, Const_Game.BuffCheckType.正四方, 0);
            } else if (this.currPickNodeComp.equipData.shuiguoId == Const_Game.FruitId.辣妹子 && this.currPickNodeComp.equipData.equipLevel == GameGlobalVariable.GameGlobalVariable.zaZhongMaxLevel - 1) {
              this.CheckUpBuff(n, false, Const_Game.BuffCheckType.同行, 1);
            } else {
              this.currPickNodeComp.equipData.shuiguoId == Const_Game.FruitId.紫薯精 && BuffMag.BuffMgr.isHaveShuiGuoBuff(71) && this.CheckUpBuff(n, false, Const_Game.BuffCheckType.同列, 0);
            }
          } else {
            this.HideJianTou();
          }
        }
      }
    }
  };
  _creator.prototype.onChildTouchUp = function () {
    var e = this;
    if (this.currPickNode) {
      this.currPickNodeComp.ShowUnLock5Tip(false, null, null);
      EventManager.EventMgr.dispatchEvent(EvenType.EVENT_TYPE.Game_Show_Level5Tip, {
        isShow: false,
        shuiGuoId: 0
      });
      this.HideJianTou();
      this.moveLength < 10 && !this.currPickNodeComp.isGeZiType && !this.currPickNodeComp.qiPaoNode.active && UIManager.default.open(BundleConfig.BundleNames.Game, UIConfig_Game.UIView_Game.UI_GameEquipInfo, {
        shuiGuoId: this.currPickNodeComp.equipData.shuiguoId,
        level: this.currPickNodeComp.equipData.equipLevel
      });
      this.moveLength = 0;
      this.currPickNode.angle = 0;
      var t = this.currPickNodeComp;
      t.ShowBuyView(function () {
        e.lastPickArray.length > 0 && e.lastPickArray.forEach(function (e) {
          e.SetBgNodeColor(cc.Color.WHITE);
        });
        if (t.lockCellArray) {
          t.lockCellArray.forEach(function (e) {
            e.DragEndLockThis(null);
          });
          t.DragEndLockCell(null);
          e.RemoveDressUplData(t.node.uuid);
          e.AddEquipPoolData(t);
        }
        e.currAddCellDataMap.delete(t.node.uuid);
        e.BackToDady(t);
        e.currPickNode = null;
        e.scheduleOnce(function () {
          e.lineTipControl.ResetMap();
        }, .5);
      }, function () {
        e.TouchUpEndCall();
      });
    }
  };
  _creator.prototype.TouchUpEndCall = function () {
    var e = this;
    var t = this.currPickNodeComp;
    this.changeFuritID = -1;
    var o = this.CheckCellIsOk(true);
    o.otherEquip || this.BagShowUnLock5Tip(t);
    var n = this.currPickNode.convertToWorldSpaceAR(cc.v2(0, 0));
    var i = this.auto_ui.btn_zanCunChuBtn.node.convertToWorldSpaceAR(cc.v2(0, 0));
    var a = false;
    if (!t.isGeZiType && -1 != GameDataManager.GameDataMgr.gameBag.zanCunUnLockBoShu && cc.Vec2.distance(n, i) < 100) {
      a = true;
      o.isOk = false;
    }
    this.lastPickArray.length > 0 && this.lastPickArray.forEach(function (e) {
      e.SetBgNodeColor(cc.Color.WHITE);
    });
    if (PlayerDataManager.PlayerDataMgr.GetGuideIndexByTaskName(Const_Common.GuideName.战斗背包) == Const_Common.GameBagGuideIndex.引导合成4) {
      if (2 == this.guide4Time) {
        o.otherEquip && (o.isOk = false);
      } else {
        -1 == this.guide4Time || 0 != this.currPickNodeComp.equipData.equipLevel || o.otherEquip && o.otherEquip.equipData.shuiguoId == this.currPickNodeComp.equipData.shuiguoId || (o.isOk = false);
      }
    }
    this.lastPickArray.length = 0;
    if (!o.isOk || o.otherEquip && o.otherEquip.equipData.isHaveQiPao) {
      this.currPickNodeComp.isGeZiType && this.currAddCellDataMap.delete(this.currPickNodeComp.node.uuid);
      if (this.currPickNodeComp.lockCellArray) {
        this.currPickNodeComp.lockCellArray.forEach(function (e) {
          e.DragEndLockThis(null);
        });
        this.currPickNodeComp.DragEndLockCell(null);
        this.RemoveDressUplData(this.currPickNode.uuid);
        this.AddEquipPoolData(this.currPickNodeComp);
      }
      if (-1 != this.guide4Time && this.guideShou) {
        this.guideShou.active = true;
        this.currPickNode.setSiblingIndex(0);
      }
      if (a) {
        _ = false;
        var r = GameDataManager.GameDataMgr.gameBag.zanCunEquipData;
        var c = this.currPickNodeComp;
        if (r && this.currZanCunChuEquip) {
          var s = false;
          if (r.equipLevel < GameGlobalVariable.GameGlobalVariable.normalMaxLevel - 1 && this.currPickNodeComp.equipData.equipLevel < GameGlobalVariable.GameGlobalVariable.normalMaxLevel - 1) {
            r.equipLevel == this.currPickNodeComp.equipData.equipLevel && r.shuiguoId == this.currPickNodeComp.equipData.shuiguoId && (s = true);
          } else if (r.equipLevel == GameGlobalVariable.GameGlobalVariable.normalMaxLevel - 1 && this.currPickNodeComp.equipData.equipLevel == GameGlobalVariable.GameGlobalVariable.normalMaxLevel - 1 && this.currPickNodeComp.equipData.shuiguoId == Logic_GetEquip.default.I.GetZaZhongId(r.shuiguoId) && Logic_GetEquip.default.I.GetMaxLevel(r.shuiguoId) == GameGlobalVariable.GameGlobalVariable.zaZhongMaxLevel) {
            s = true;
            _ = true;
            if (0 == (y = Excel.Excel.shuiguo(this.currPickNodeComp.equipData.shuiguoId)).jinjieShuiGuoId) {
              c = this.currZanCunChuEquip;
              this.currZanCunChuEquip = this.currPickNodeComp;
            }
          }
          if (s) {
            c.equipData.equipLevel++;
            c.equipData.equipLevel == GameGlobalVariable.GameGlobalVariable.normalMaxLevel - 1 && this.ShowOneLevel5Tip(c.equipData.shuiguoId, c);
            window.mg && mg.vibrateShort();
            c.ResetShow();
            this.ShowDragBone(this.auto_ui.node_zanCunEquipFather.convertToWorldSpaceAR(cc.v2(0, 0)));
            c.equipData.equipLevel == GameGlobalVariable.GameGlobalVariable.zaZhongMaxLevel - 1 && UIManager.default.open(BundleConfig.BundleNames.Game, UIConfig_Game.UIView_Game.UI_GetZaZhong, {
              shuiGuoId: c.equipData.shuiguoId
            });
            this.RemoveDressUplData(this.currZanCunChuEquip.node.uuid);
            this.RemoveEquipPoolData(this.currZanCunChuEquip.node.uuid);
            this.RecycleEquip(this.currZanCunChuEquip.node);
          } else {
            this.currZanCunChuEquip.node.scale = 1;
            this.AddEquipPoolData(this.currZanCunChuEquip);
            this.BackToDady(this.currZanCunChuEquip);
          }
        }
        this.RemoveDressUplData(c.node.uuid);
        this.RemoveEquipPoolData(c.node.uuid);
        GameDataManager.GameDataMgr.gameBag.zanCunEquipData = c.equipData;
        this.currZanCunChuEquip = c;
        this.currPickNode.parent = this.auto_ui.node_zanCunEquipFather;
        this.currPickNode.setPosition(this.currPickNode.parent.convertToNodeSpaceAR(n));
        var u = this.currPickNode.width > this.currPickNode.height ? 100 / this.currPickNode.width : 100 / this.currPickNode.height;
        u = u > 1 ? 1 : u;
        this.currPickNode.runAction(cc.spawn(cc.scaleTo(this.xifuTime, u, u), cc.moveTo(this.xifuTime, 0, 50)));
      } else {
        this.BackToDady(this.currPickNodeComp);
      }
    } else {
      AudioManager.AudioMgr.playEffect("audio/effect/fangEquip");
      if (this.guideShou && PlayerDataManager.PlayerDataMgr.GetGuideIndexByTaskName(Const_Common.GuideName.战斗背包) != Const_Common.GameBagGuideIndex.引导格子8) {
        GuideControl.GuideCtrl.RecycleOneShou(this.guideShou);
        this.guideShou = null;
        this.scheduleOnce(function () {
          e.CheckGuide();
        }, .5);
      }
      PlayerDataManager.PlayerDataMgr.GetGuideIndexByTaskName(Const_Common.GuideName.战斗背包) == Const_Common.GameBagGuideIndex.引导格子8 && this.currPickNodeComp.isGeZiType && this.GuideCheckCell(o.pickCellArray) && this.ShowGuide8_1(t);
      if (o.pickCellArray) {
        if (this.currPickNodeComp.isGeZiType) {
          this.currAddCellDataMap.set(this.currPickNode.uuid, {
            cellNode: this.currPickNode,
            pickCellArray: o.pickCellArray
          });
          this.currPickNode.runAction(cc.moveTo(this.xifuTime, this.currPickNode.x + o.effectPos.x, this.currPickNode.y + o.effectPos.y));
        } else {
          if (this.currPickNodeComp.lockCellArray) {
            this.currPickNodeComp.lockCellArray.forEach(function (e) {
              GameDataManager.GameDataMgr.gameBag.bagArray[e.cellData.cellIndex] = 0;
              e.DragEndLockThis(null);
            });
            this.RemoveDressUplData(this.currPickNode.uuid);
          } else {
            this.RemoveEquipPoolData(this.currPickNode.uuid);
          }
          o.pickCellArray.forEach(function (t) {
            if (t.equipComp && e.dressUpEquipMap.has(t.equipComp.node.uuid)) {
              e.RemoveDressUplData(t.equipComp.node.uuid);
              var o = t.equipComp;
              o.lockCellArray.forEach(function (e) {
                GameDataManager.GameDataMgr.gameBag.bagArray[e.cellData.cellIndex] = 0;
                e.DragEndLockThis(null);
              });
              o.DragEndLockCell(null);
              e.AddEquipPoolData(o);
              e.BackToDady(o);
            }
          });
          this.currPickNode.parent = this.auto_ui.node_DragEndNode;
          var l = cc.v2(this.currPickNode.x + o.effectPos.x, this.currPickNode.y + o.effectPos.y);
          this.currPickNode.runAction(cc.sequence(cc.moveTo(this.xifuTime, l.x, l.y), cc.delayTime(.15), cc.callFunc(function () {
            e.CheckDressUpLabel(t);
          })));
          this.currPickNodeComp.DragEndLockCell(o.pickCellArray);
          o.pickCellArray.forEach(function (t) {
            GameDataManager.GameDataMgr.gameBag.bagArray[t.cellData.cellIndex] = 1;
            t.DragEndLockThis(e.currPickNodeComp);
          });
          this.AddDressUpData(this.currPickNodeComp, l);
        }
      } else if (o.otherEquip) {
        var p = o.otherEquip.lockCellArray;
        var g = this.currPickNodeComp.lockCellArray;
        var _ = false;
        var m = null;
        if (this.currPickNodeComp.equipData.equipLevel < GameGlobalVariable.GameGlobalVariable.normalMaxLevel - 1) {
          this.currPickNodeComp.equipData.equipLevel++;
          window.mg && mg.vibrateShort();
          this.currPickNodeComp.equipData.equipLevel == GameGlobalVariable.GameGlobalVariable.normalMaxLevel - 1 && this.ShowOneLevel5Tip(this.currPickNodeComp.equipData.shuiguoId, this.currPickNodeComp);
        } else if (this.currPickNodeComp.equipData.equipLevel < GameGlobalVariable.GameGlobalVariable.zaZhongMaxLevel - 1) {
          _ = true;
          var y = Excel.Excel.shuiguo(this.currPickNodeComp.equipData.shuiguoId);
          var v = o.otherEquip;
          var P = this.currPickNodeComp;
          if (0 == y.jinjieShuiGuoId) {
            m = v.node.convertToWorldSpaceAR(cc.v2(0, 0));
            var N = this.currPickNodeComp.node.convertToWorldSpaceAR(cc.v2(0, 0));
            o.otherEquip = P;
            o.otherEquip.node.setPosition(o.otherEquip.node.parent.convertToNodeSpaceAR(N));
            this.currPickNodeComp = v;
            this.currPickNodeComp.node.setPosition(this.currPickNodeComp.node.parent.convertToNodeSpaceAR(m));
            t = this.currPickNodeComp;
            o.zaZhongPickCells = p;
          }
          this.RemoveDressUplData(v.node.uuid);
          this.RemoveDressUplData(P.node.uuid);
          this.RemoveEquipPoolData(v.node.uuid);
          this.RemoveEquipPoolData(P.node.uuid);
          this.currPickNodeComp.equipData.equipLevel++;
          window.mg && mg.vibrateShort();
          UIManager.default.open(BundleConfig.BundleNames.Game, UIConfig_Game.UIView_Game.UI_GetZaZhong, {
            shuiGuoId: this.currPickNodeComp.equipData.shuiguoId
          });
        }
        if (_) {
          AudioManager.AudioMgr.playEffect("game/sound/upLevel5", false, BundleConfig.BundleNames.Game);
        } else {
          AudioManager.AudioMgr.playEffect("audio/effect/gameBagHeCheng");
        }
        this.currPickNodeComp.ResetShow();
        this.ShowDragBone(o.otherEquip.node.convertToWorldSpaceAR(cc.v2(0, 0)));
        this.currPickNode.angle = 0;
        if (p && o.otherEquip.equipData.pfbName == this.currPickNodeComp.equipData.pfbName) {
          if (g) {
            g.forEach(function (e) {
              GameDataManager.GameDataMgr.gameBag.bagArray[e.cellData.cellIndex] = 0;
              e.DragEndLockThis(null);
            });
            this.RemoveDressUplData(this.currPickNode.uuid);
          } else {
            this.RemoveEquipPoolData(this.currPickNode.uuid);
          }
          this.currPickNodeComp.DragEndLockCell(p);
          this.currPickNodeComp.lockCellArray.forEach(function (t) {
            t.DragEndLockThis(e.currPickNodeComp);
          });
          this.currPickNode.parent = this.auto_ui.node_DragEndNode;
          l = o.otherEquip.node.getPosition();
          this.currPickNode.runAction(cc.sequence(cc.moveTo(this.xifuTime, l.x, l.y), cc.delayTime(.15), cc.callFunc(function () {
            e.CheckUpLevelLabel(t);
          })));
          this.RemoveDressUplData(o.otherEquip.node.uuid);
          this.AddDressUpData(this.currPickNodeComp, l);
        } else {
          p && p.forEach(function (e) {
            GameDataManager.GameDataMgr.gameBag.bagArray[e.cellData.cellIndex] = 0;
            e.DragEndLockThis(null);
          });
          if (_) {
            g && g.forEach(function (e) {
              GameDataManager.GameDataMgr.gameBag.bagArray[e.cellData.cellIndex] = 0;
              e.DragEndLockThis(null);
            });
            if (o.zaZhongPickCells && o.zaZhongPickCells.length > 0) {
              o.zaZhongPickCells.forEach(function (t) {
                GameDataManager.GameDataMgr.gameBag.bagArray[t.cellData.cellIndex] = 1;
                t.DragEndLockThis(e.currPickNodeComp);
              });
              this.currPickNodeComp.DragEndLockCell(o.zaZhongPickCells);
              this.currPickNode.parent = this.auto_ui.node_DragEndNode;
              var T = o.zaZhongPickCells[0].node.convertToWorldSpaceAR(cc.v2(0, 0));
              var S = this.currPickNodeComp.GetGeZi().children[0].convertToWorldSpaceAR(cc.v2(0, 0));
              var O = cc.v2(T.x - S.x, T.y - S.y);
              var R = cc.v2(this.currPickNode.x + O.x, this.currPickNode.y + O.y);
              m && (R = this.currPickNodeComp.node.parent.convertToNodeSpaceAR(m));
              this.currPickNode.runAction(cc.moveTo(this.xifuTime, R.x, R.y));
              this.AddDressUpData(this.currPickNodeComp, R);
            } else {
              this.AddEquipPoolData(this.currPickNodeComp);
              this.BackToDady(this.currPickNodeComp, function () {
                e.CheckUpLevelLabel(t);
              });
            }
          } else {
            if (g) {
              g.forEach(function (e) {
                GameDataManager.GameDataMgr.gameBag.bagArray[e.cellData.cellIndex] = 0;
                e.DragEndLockThis(null);
              });
              this.currPickNodeComp.DragEndLockCell(null);
              this.RemoveDressUplData(this.currPickNode.uuid);
              this.AddEquipPoolData(this.currPickNodeComp);
            }
            this.RemoveEquipPoolData(o.otherEquip.node.uuid);
            this.BackToDady(this.currPickNodeComp, function () {
              e.CheckUpLevelLabel(t);
            });
          }
        }
        this.RecycleEquip(o.otherEquip.node);
      }
      if (this.currPickNodeComp.equipData.shuiguoId == Const_Game.FruitId.柠檬精) {
        this.CheckUpBuff(this.currPickNodeComp.equipData.lockCellIndex, true, Const_Game.BuffCheckType.正四方, 0);
      } else if (this.currPickNodeComp.equipData.shuiguoId == Const_Game.FruitId.辣妹子 && this.currPickNodeComp.equipData.equipLevel == GameGlobalVariable.GameGlobalVariable.zaZhongMaxLevel - 1) {
        this.CheckUpBuff(this.currPickNodeComp.equipData.lockCellIndex, true, Const_Game.BuffCheckType.同行, 1);
      } else {
        this.currPickNodeComp.equipData.shuiguoId == Const_Game.FruitId.紫薯精 && BuffMag.BuffMgr.isHaveShuiGuoBuff(71) && this.CheckUpBuff(this.currPickNodeComp.equipData.lockCellIndex, true, Const_Game.BuffCheckType.同列, 0);
      }
    }
    this.changeFuritID != Const_Game.FruitId.紫薯精 && this.currPickNodeComp.equipData.shuiguoId != Const_Game.FruitId.紫薯精 && this.currPickNodeComp.equipData.shuiguoId != Const_Game.FruitId.至尊棒 || this.cpBuffControl.CheckBuff(Const_Game.FruitId.紫薯精, this);
    this.scheduleOnce(function () {
      e.lineTipControl.ResetMap();
    }, .5);
    this.currPickNode = null;
    this.SaveData();
    this.scheduleOnce(function () {
      e.AICheck();
    }, AIControl.default._instance.startDelayTime);
  };
  _creator.prototype.CheckCellIsOk = function (e) {
    var t;
    var o;
    var n = this;
    var i = this.currPickNodeComp.GetGeZi();
    var a = true;
    var r = null;
    var c = [];
    var s = [];
    var u = this.auto_ui.node_cubeFather;
    var p = GameDataManager.GameDataMgr.gameBag.bagArray;
    this.currPickNodeComp.isGeZiType && (u = this.auto_ui.node_cubeBaseFather);
    var h = [];
    for (var g = 0; g < u.childrenCount; g++) {
      var _ = u.children[g];
      h.push(_.convertToWorldSpaceAR(cc.v2(0, 0)));
    }
    for (var m = 0; m < i.childrenCount; m++) {
      var y = i.children[m].convertToWorldSpaceAR(cc.v2(0, 0));
      var v = false;
      var b = function (e) {
        var t = w.currPickNodeComp.isGeZiType ? e : u.children[e].getComponent(Item_GameBagCell.default).cellData.cellIndex;
        if (w.currPickNodeComp.isGeZiType) {
          var o = false;
          w.currAddCellDataMap.size > 0 && w.currAddCellDataMap.forEach(function (e) {
            if (e.cellNode != n.currPickNode && e.pickCellArray && !o) {
              for (var i = 0; i < e.pickCellArray.length; i++) {
                var a = e.pickCellArray[i];
                if (t == a.cellData.cellIndex) {
                  o = true;
                  break;
                }
              }
            }
          });
          if (o) {
            return "continue";
          }
        }
        var i = -1 != p[t] && !w.currPickNodeComp.isGeZiType;
        var a = -1 == p[t] && w.currPickNodeComp.isGeZiType;
        if ((i || a) && cc.Vec2.distance(y, h[e]) < w.effectMax) {
          v = true;
          s.push(t);
          r || (r = cc.v2(h[e].x - y.x, h[e].y - y.y));
          return "break";
        }
      };
      var w = this;
      for (g = 0; g < u.childrenCount && "break" !== b(g); g++) {
        ;
      }
      v || (a = false);
    }
    this.lastPickArray.length > 0 && this.lastPickArray.forEach(function (e) {
      e.SetBgNodeColor(cc.Color.WHITE);
    });
    this.lastPickArray.length = 0;
    s.forEach(function (e) {
      var t;
      (t = n.currPickNodeComp.isGeZiType ? n.baseCellCompArray[e] : n.cellCompMap.get(e)).SetBgNodeColor(a ? cc.Color.GREEN : cc.Color.RED);
      n.lastPickArray.push(t);
      c.push(t);
    });
    var I = this.currPickNodeComp.equipData.equipLevel == GameGlobalVariable.GameGlobalVariable.normalMaxLevel - 1;
    if (a && !this.currPickNodeComp.isGeZiType && c.length > 0 && this.currPickNodeComp.equipData.equipLevel < Logic_GetEquip.default.I.GetMaxLevel(this.currPickNodeComp.equipData.shuiguoId) - 1) {
      var E = true;
      if (I) {
        E = false;
        var M = function (i) {
          var a = c[i];
          if (a.equipComp && a.equipComp.equipData.equipLevel == C.currPickNodeComp.equipData.equipLevel && Logic_GetEquip.default.I.GetZaZhongId(a.equipComp.equipData.shuiguoId) == C.currPickNodeComp.equipData.shuiguoId) {
            E = true;
            o = a.equipComp;
            if (e && c && c.length > 0) {
              var r = [];
              c.forEach(function (e) {
                e && e.equipComp && e.equipComp != n.currPickNodeComp && e.equipComp != o && -1 == r.indexOf(e.equipComp) && r.push(e.equipComp);
              });
              r.forEach(function (e) {
                n.RemoveDressUplData(e.node.uuid);
                n.AddEquipPoolData(e);
                n.BackToDady(e);
                e.lockCellArray && e.lockCellArray.forEach(function (e) {
                  GameDataManager.GameDataMgr.gameBag.bagArray[e.cellData.cellIndex] = 0;
                  e.DragEndLockThis(null);
                });
                e.DragEndLockCell(null);
              });
            }
            t = c;
            c = null;
            return "break";
          }
        };
        var C = this;
        for (g = 0; g < c.length && "break" !== M(g); g++) {
          ;
        }
      } else {
        for (g = 0; g < c.length; g++) {
          var x = c[g];
          if (null == x.equipComp || x.equipComp.uuid == this.currPickNodeComp.uuid || x.equipComp.equipData.equipLevel != this.currPickNodeComp.equipData.equipLevel) {
            E = false;
            break;
          }
          if (x.equipComp.equipData.shuiguoId != this.currPickNodeComp.equipData.shuiguoId && x.equipComp.equipData.equipLevel < GameGlobalVariable.GameGlobalVariable.normalMaxLevel - 1) {
            E = false;
            break;
          }
        }
      }
      if (E && !o) {
        o = c[0].equipComp;
        c = null;
      }
    }
    var k = I ? 200 : 100;
    if (!a && !this.currPickNodeComp.isGeZiType) {
      c = null;
      var B = this.currPickNode.convertToWorldSpaceAR(cc.v2(0, 0));
      this.equipPool.forEach(function (e) {
        if (!o) {
          var t = e;
          var i = t.node.convertToWorldSpaceAR(cc.v2(0, 0));
          t.node.uuid != n.currPickNode.uuid && n.currPickNodeComp.equipData.equipLevel < Logic_GetEquip.default.I.GetMaxLevel(n.currPickNodeComp.equipData.shuiguoId) - 1 && t.equipData.equipLevel == n.currPickNodeComp.equipData.equipLevel && cc.Vec2.distance(i, B) < k && (t.equipData.shuiguoId != n.currPickNodeComp.equipData.shuiguoId && t.equipData.equipLevel < GameGlobalVariable.GameGlobalVariable.normalMaxLevel - 1 || Logic_GetEquip.default.I.GetZaZhongId(t.equipData.shuiguoId) != n.currPickNodeComp.equipData.shuiguoId && t.equipData.equipLevel == GameGlobalVariable.GameGlobalVariable.normalMaxLevel - 1 || (o = t, a = true, r = cc.v2(i.x - B.x, i.y - B.y)));
        }
      });
      o || this.dressUpEquipMap.forEach(function (e, t) {
        if (!o) {
          var i = e;
          var c = i.node.convertToWorldSpaceAR(cc.v2(0, 0));
          t != n.currPickNode.uuid && n.currPickNodeComp.equipData.equipLevel < Logic_GetEquip.default.I.GetMaxLevel(n.currPickNodeComp.equipData.shuiguoId) - 1 && i.equipData.equipLevel == n.currPickNodeComp.equipData.equipLevel && cc.Vec2.distance(c, B) < k && (i.equipData.shuiguoId != n.currPickNodeComp.equipData.shuiguoId && i.equipData.equipLevel < GameGlobalVariable.GameGlobalVariable.normalMaxLevel - 1 || Logic_GetEquip.default.I.GetZaZhongId(i.equipData.shuiguoId) != n.currPickNodeComp.equipData.shuiguoId && i.equipData.equipLevel == GameGlobalVariable.GameGlobalVariable.normalMaxLevel - 1 || (o = i, a = true, r = cc.v2(c.x - B.x, c.y - B.y)));
        }
      });
    }
    return {
      isOk: a,
      effectPos: r,
      pickCellArray: c,
      otherEquip: o,
      zaZhongPickCells: t
    };
  };
  _creator.prototype.RecycleEquip = function (e) {
    e.destroy();
  };
  _creator.prototype.GetEquipNode = function (e) {
    var t = this.auto_ui.node_EquipFather.getChildByName(e);
    if (t) {
      return cc.instantiate(t);
    } else {
      return null;
    }
  };
  _creator.prototype.RemoveEquipPoolData = function (e) {
    var t = this.equipPool.get(e);
    if (t) {
      var o = t.equipData;
      for (var n = 0; n < GameDataManager.GameDataMgr.gameBag.equipPool.length; n++) {
        var i = GameDataManager.GameDataMgr.gameBag.equipPool[n];
        if (i.equipLevel == o.equipLevel && i.shuiguoId == o.shuiguoId && this.ComparisonArray(i.lockCellIndex, o.lockCellIndex)) {
          GameDataManager.GameDataMgr.gameBag.equipPool.splice(n, 1);
          break;
        }
      }
      this.equipPool.delete(e);
    }
  };
  _creator.prototype.AddEquipPoolData = function (e) {
    e.equipData.wPostion = null;
    e.equipData.selfPos = null;
    this.equipPool.set(e.node.uuid, e);
    GameDataManager.GameDataMgr.gameBag.equipPool.push(e.equipData);
  };
  _creator.prototype.RemoveDressUplData = function (e) {
    var t = this.dressUpEquipMap.get(e);
    if (t) {
      var o = t.equipData;
      for (var n = 0; n < GameDataManager.GameDataMgr.gameBag.dressUpEquips.length; n++) {
        var i = GameDataManager.GameDataMgr.gameBag.dressUpEquips[n];
        if (i.equipLevel == o.equipLevel && i.shuiguoId == o.shuiguoId && this.ComparisonArray(i.lockCellIndex, o.lockCellIndex)) {
          GameDataManager.GameDataMgr.gameBag.dressUpEquips.splice(n, 1);
          break;
        }
      }
      this.dressUpEquipMap.delete(e);
      this.currPickNodeComp.equipData.shuiguoId != Const_Game.FruitId.紫薯精 && this.currPickNodeComp.equipData.shuiguoId != Const_Game.FruitId.至尊棒 || (this.changeFuritID = Const_Game.FruitId.紫薯精);
    }
  };
  _creator.prototype.AddDressUpData = function (e, t) {
    e.equipData.wPostion = this.auto_ui.node_DragEndNode.convertToWorldSpaceAR(cc.v2(t.x, t.y - this.viewNodePosY));
    e.equipData.selfPos = cc.v2(t.x, t.y - this.viewNodePosY);
    LogManager.LogMgr.debug(e.equipData.wPostion, t);
    this.dressUpEquipMap.set(e.node.uuid, e);
    GameDataManager.GameDataMgr.gameBag.dressUpEquips.push(e.equipData);
  };
  _creator.prototype.ComparisonArray = function (e, t) {
    return null == e && null == t || null != e && null != t && e.length == t.length && e.every(function (e) {
      return -1 != t.indexOf(e);
    });
  };
  _creator.prototype.SaveData = function () {
    GameDataManager.GameDataMgr.SaveGameBagData();
    EventManager.EventMgr.dispatchEvent(EvenType.EVENT_TYPE.GAME_UPDATE_BAG);
  };
  _creator.prototype.SetCellFatherMove = function (e) {
    var t = this;
    this.cellFatherMove.SetCanMove(e, true);
    this.auto_ui.node_bottomBtn.active = !e;
    this.auto_ui.btn_UseGeZiBtn.node.active = e;
    this.auto_ui.node_useGeZiTip.active = e;
    this.auto_ui.btn_VideoGetCell.node.active = !e;
    this.auto_ui.btn_zanCunChuBtn.node.active = !e;
    if (e) {
      this.auto_ui.node_useGeZiTip.stopAllActions();
      this.auto_ui.node_useGeZiTip.runAction(cc.repeatForever(cc.sequence(cc.scaleTo(1, .8, .8), cc.scaleTo(1, .7, .7))));
    }
    if (PlayerDataManager.PlayerDataMgr.GetGuideIndexByTaskName(Const_Common.GuideName.战斗背包) == Const_Common.GameBagGuideIndex.引导格子8 && e) {
      this.auto_ui.btn_UseGeZiBtn.interactable = false;
    } else {
      this.auto_ui.btn_UseGeZiBtn.interactable = true;
    }
    this.equipPool.forEach(function (t) {
      t.isGeZiType || t.SetCanClick(!e, true);
    });
    this.dressUpEquipMap.forEach(function (t) {
      t.SetCanClick(!e, true);
    });
    if (e) {
      this.auto_ui.node_cubeBaseFather.opacity = 255;
    } else {
      this.auto_ui.node_cubeBaseFather.opacity = 0;
      if (this.currAddCellDataMap.size > 0) {
        this.CheckDragCellIsOk();
        this.currAddCellDataMap.forEach(function (e) {
          e.pickCellArray.forEach(function (e) {
            GameDataManager.GameDataMgr.gameBag.bagArray[e.cellData.cellIndex] = 0;
            var o = t.baseCellCompArray[e.cellData.cellIndex].node;
            var n = cc.instantiate(o);
            n.parent = t.auto_ui.node_cubeFather;
            n.setPosition(n.parent.convertToNodeSpaceAR(o.convertToWorldSpaceAR(cc.v2(0, 0))));
            t.cellCompMap.set(e.cellData.cellIndex, n.getComponent(Item_GameBagCell.default));
            t.cellCompMap.get(e.cellData.cellIndex).StartSet(e.cellData, true);
            n.name = "方块" + e.cellData.cellIndex;
          });
          t.RemoveEquipPoolData(e.cellNode.uuid);
          t.RecycleEquip(e.cellNode);
        });
        var o = cc.v2(44, 32);
        var n = this.ChangeSizeByChild(this.auto_ui.node_cubeFather, o);
        this.dressUpEquipMap.forEach(function (e) {
          e.node.x += n.x;
          e.node.y += n.y;
        });
        this.currAddCellDataMap.clear();
      }
    }
    this.SetBgNodeSize(e);
    if (!e) {
      var i = GameGlobalVariable.GameGlobalVariable.bagVideoCellCount;
      this.auto_ui.btn_VideoGetCell.node.active = this.maxX * this.maxY - this.cellCompMap.size > 0 && GameDataManager.GameDataMgr.gameBag.videoCellCount < i;
      GameGlobalVariable.GameGlobalVariable.nowlevel <= 1 && 2 == GameGlobalVariable.GameGlobalVariable.isTeShuLevel() && (this.auto_ui.btn_zanCunChuBtn.node.active = false);
    }
  };
  _creator.prototype.MoveChangeBagCellIndex = function (e) {
    var t = this;
    if (e && e.isOk) {
      var o = [];
      this.auto_ui.node_cubeFather.children.forEach(function (t, n) {
        var i = t.getComponent(Item_GameBagCell.default);
        !e.pickCellArray[n] && e.pickCellArray[n];
        t.name = "方块" + e.pickCellArray[n];
        i.SetCellData({
          cellIndex: e.pickCellArray[n]
        });
        i.equipComp && -1 == o.indexOf(i.equipComp) && o.push(i.equipComp);
      });
      GameDataManager.GameDataMgr.gameBag.equipPool = [];
      o.forEach(function (e) {
        var t = e.lockCellArray;
        var o = [];
        t.forEach(function (e) {
          o.push(e.cellData.cellIndex);
        });
        e.equipData.lockCellIndex = o;
        GameDataManager.GameDataMgr.gameBag.equipPool.push(e.equipData);
      });
      var n = [];
      this.cellCompMap.forEach(function (e) {
        n.push(e);
      });
      this.cellCompMap.clear();
      n.forEach(function (e) {
        t.cellCompMap.set(e.cellData.cellIndex, e);
      });
      var i = GameDataManager.GameDataMgr.gameBag.bagArray;
      for (var a = 0; a < i.length; a++) {
        if (this.cellCompMap.has(a)) {
          if (this.cellCompMap.get(a).equipComp) {
            GameDataManager.GameDataMgr.gameBag.bagArray[a] = 1;
          } else {
            GameDataManager.GameDataMgr.gameBag.bagArray[a] = 0;
          }
        } else {
          GameDataManager.GameDataMgr.gameBag.bagArray[a] = -1;
        }
      }
    }
  };
  _creator.prototype.CheckDragCellIsOk = function () {
    var e = this;
    var t = [];
    var o = [];
    this.currAddCellDataMap.forEach(function (e, n) {
      var i = [];
      e.pickCellArray.forEach(function (e) {
        i.push(e.cellData.cellIndex);
      });
      t.push(i);
      o.push(n);
    });
    var n = GameDataManager.GameDataMgr.gameBag.bagArray;
    for (var i = 0; i < t.length; i++) {
      for (var a = 0; a < t.length; a++) {
        var r = t[a];
        if (r && this.CheckOneCellArrayIsOk(r, n)) {
          r.forEach(function (e) {
            n[e] = 0;
          });
          t[a] = null;
          o[a] = null;
        }
      }
    }
    o.every(function (e) {
      return null == e;
    }) || TipsManager.TipMgr.showToast("请将扩展格放置在相邻地块");
    o.forEach(function (t) {
      if (t) {
        var o = e.equipPool.get(t);
        e.BackToDady(o);
        if (o.lockCellArray) {
          o.lockCellArray.forEach(function (e) {
            e.DragEndLockThis(null);
          });
          o.DragEndLockCell(null);
        }
      }
      e.currAddCellDataMap.delete(t);
    });
  };
  _creator.prototype.CheckOneCellArrayIsOk = function (e, t) {
    var o = false;
    for (var n = 0; n < e.length; n++) {
      var i = e[n];
      var a = false;
      (i - 1 >= 0 && (i - 1) % this.maxX != this.maxX - 1 && t[i - 1] >= 0 || i - this.maxX >= 0 && t[i - this.maxX] >= 0 || i + 1 < t.length && (i + 1) % this.maxX != 0 && t[i + 1] >= 0 || i + this.maxX < t.length && t[i + this.maxX] >= 0) && (a = true);
      if (a) {
        o = true;
        break;
      }
    }
    return o;
  };
  _creator.prototype.SetBgNodeSize = function (e) {
    var t = this;
    this.scheduleOnce(function () {
      t.auto_ui.node_diTuNode.active = true;
      if (e) {
        t.auto_ui.node_diTuNode.width = t.auto_ui.node_cubeBaseFather.width;
        t.auto_ui.node_diTuNode.height = t.auto_ui.node_cubeBaseFather.height;
        t.auto_ui.node_diTuNode.setAnchorPoint(t.auto_ui.node_cubeBaseFather.getAnchorPoint());
        t.auto_ui.node_diTuNode.setPosition(t.auto_ui.node_cubeBaseFather.getPosition());
      } else {
        t.auto_ui.node_cubeFather.setPosition(0, 0);
        var o = t.auto_ui.node_cubeFather.width;
        var n = t.auto_ui.node_cubeFather.height;
        t.auto_ui.node_diTuNode.width = o;
        t.auto_ui.node_diTuNode.height = n;
        t.auto_ui.node_diTuNode.setPosition(0, 0);
        t.auto_ui.node_DragEndNode.setPosition(0, 0);
        t.dressUpEquipMap.forEach(function (e) {
          e.equipData.wPostion = e.node.convertToWorldSpaceAR(cc.v2(0, -1 * t.viewNodePosY));
          e.equipData.selfPos = cc.v2(e.node.x, e.node.y + -1 * t.viewNodePosY);
        });
        t.SaveCellWpos();
      }
    });
  };
  _creator.prototype.ChangeSizeByChild = function (e, t) {
    var o = 1e4;
    var n = -1e4;
    var i = 1e4;
    var a = -1e4;
    var r = [];
    for (var c = 0; c < e.children.length; c++) {
      var s = (h = e.children[c]).convertToWorldSpaceAR(cc.v2(0, 0));
      s.x - h.width / 2 < o && (o = s.x - h.width / 2);
      s.x + h.width / 2 > n && (n = s.x + h.width / 2);
      s.y - h.height / 2 < i && (i = s.y - h.height / 2);
      s.y + h.height / 2 > a && (a = s.y + h.height / 2);
      r.push(s);
    }
    var u = n - o + t.x;
    var l = a - i + t.y;
    e.width = u;
    e.height = l;
    var d = e.convertToWorldSpaceAR(cc.v2(0, 0));
    var p = cc.v2((n + o) / 2, (a + i) / 2);
    e.setPosition(e.parent.convertToNodeSpaceAR(p));
    for (c = 0; c < e.children.length; c++) {
      var h;
      (h = e.children[c]).setPosition(e.convertToNodeSpaceAR(r[c]));
    }
    return cc.v2(d.x - p.x, d.y - p.y);
  };
  _creator.prototype.SaveCellWpos = function () {
    var e = this;
    var t = [];
    this.auto_ui.node_cubeFather.children.forEach(function (o) {
      t.push(o.convertToWorldSpaceAR(cc.v2(0, -1 * e.viewNodePosY)));
    });
    GameDataManager.GameDataMgr.gameBag.cellWposArray = t;
    GameDataManager.GameDataMgr.SaveGameBagData();
    EventManager.EventMgr.dispatchEvent(EvenType.EVENT_TYPE.GAME_UPDATE_BAG);
  };
  _creator.prototype.BackToDady = function (e, t) {
    var o = this;
    undefined === t && (t = null);
    var n = e.node.convertToWorldSpaceAR(cc.v2(0, 0));
    var i = this.auto_ui.node_DragFather.children.length;
    for (var a = 0; a < this.auto_ui.node_DragFather.children.length; a++) {
      var r = this.auto_ui.node_DragFather.children[a].convertToWorldSpaceAR(cc.v2(0, 0));
      if (n.x < r.x) {
        i = a;
        break;
      }
    }
    var c = e.equipIcon;
    c.parent = this.auto_ui.node_DragTempNode;
    c.setPosition(c.parent.convertToNodeSpaceAR(n));
    e.node.parent = this.auto_ui.node_DragFather;
    e.node.setSiblingIndex(i);
    e.node.setPosition(0, 0);
    e.SetCanClick(false);
    e.scheduleOnce(function () {
      c.parent = e.node;
      c.setSiblingIndex(2);
      c.setPosition(c.parent.convertToNodeSpaceAR(n));
      var i = Math.random();
      var a = 0;
      if (i > .66) {
        a = 20;
      } else {
        i < .33 && (a = -20);
      }
      c.runAction(cc.sequence(cc.spawn(cc.moveTo(o.moveTime, 0, 0), cc.rotateTo(o.moveTime, a)), cc.delayTime(.15), cc.callFunc(function () {
        e.SetCanClick(true);
        e.node.angle = c.angle;
        c.angle = 0;
        t && t();
      })));
    });
    this.CheckDragFatherLayout();
  };
  _creator.prototype.ShowDragBone = function (e) {
    var t = this.auto_ui.dbAnim_heChengEffect.node;
    t.setPosition(t.parent.convertToNodeSpaceAR(e));
    t.active = true;
    this.auto_ui.dbAnim_heChengEffect.playAnimation("newAnimation", 1);
  };
  _creator.prototype.MakePaiZi = function (e) {
    var t = cc.instantiate(this.paiZiPfb);
    t.parent = e;
    return t.getComponent(Item_PaiZi.default);
  };
  _creator.prototype.CheckDragFatherLayout = function (e, t) {
    undefined === e && (e = null);
    undefined === t && (t = 0);
    var o = 30;
    var n = this.auto_ui.node_DragFather.getComponent(cc.Layout);
    var i = this.equipPool.size + t;
    if (i >= 3) {
      var a = 0;
      this.equipPool.forEach(function (t) {
        e && e == t.node.uuid || (a += t.node.width);
      });
      if (a > 700) {
        o = (700 - a) / (i - 1);
        o = Math.floor(o);
      }
    }
    if (n.spacingX != o) {
      n.spacingX = o;
      n.updateLayout();
    }
  };
  _creator.prototype.CheckDressUpLabel = function (e) {
    if (-1 == this.firstUseArray.indexOf(e.equipData.shuiguoId)) {
      this.firstUseArray.push(e.equipData.shuiguoId);
      var t = Excel.Excel.shuiguo(e.equipData.shuiguoId);
      var o = e.node.convertToWorldSpaceAR(cc.v2(0, 0));
      o.y += .7 * e.node.height;
      var n = "<color=#ffffff>" + t.starWord + "</c>";
      this.ShowTipNode(n, o, 1.5);
      var i = Math.floor(5 * Math.random());
      AudioManager.AudioMgr.playEffect("game/sound/dressUp" + (i + 1), false, BundleConfig.BundleNames.Game);
    }
  };
  _creator.prototype.CheckUpLevelLabel = function (e) {
    if (e.equipData.equipLevel != GameGlobalVariable.GameGlobalVariable.normalMaxLevel) {
      var t = "";
      var o = e.equipData.shuiguoId;
      var n = 1.5;
      if (Logic_GetEquip.default.I.GetMaxLevel(o) == GameGlobalVariable.GameGlobalVariable.zaZhongMaxLevel && e.equipData.equipLevel == GameGlobalVariable.GameGlobalVariable.normalMaxLevel - 1 && Logic_GetEquip.default.I.GetMaxLevel(this.currPickNodeComp.equipData.shuiguoId) == GameGlobalVariable.GameGlobalVariable.zaZhongMaxLevel) {
        var i = Excel.Excel.shuiguo(o);
        var a = Excel.Excel.shuiguo(Logic_GetEquip.default.I.GetZaZhongId(o));
        var r = "player" + ((0 != i.jinjieShuiGuoId ? i : a).id - 1e3) + "_5";
        t = "<color=#ffffff>可与4阶" + a.name + "杂交合成至5阶</c><img src='" + r + "'/>";
        n = 4.5;
      } else {
        var c = Logic_GetEquip.default.I.GetEquipUpData(o, e.equipData.equipLevel);
        if (0 != c.addattack) {
          if (o == Const_Game.FruitId.辣妹子) {
            t += "<color=#ffffff>攻击速度光环 + </c><color=#00ff00>100</c> <color=#ffffff>%</c>";
          } else {
            t += "<color=#ffffff>攻击力 + </c><color=#00ff00>100</c> <color=#ffffff>%</c>";
          }
        }
        0 != c.addattackspeed && (t += "<color=#ffffff>技能速度 + </c><color=#00ff00>100</c> <color=#ffffff>%</c>");
        if (c.addbeidongbuff.length > 0 && 0 != c.addbeidongbuff[0]) {
          if (o == Const_Game.FruitId.招财橙子) {
            t += "<color=#ffffff>产出银币翻倍</c>";
          } else if (o == Const_Game.FruitId.柠檬精) {
            t += "<color=#ffffff>攻击力光环 + </c><color=#00ff00>100 <color=#ffffff>%</c>";
          } else {
            t += "<color=#ffffff>天赋加成效果翻倍</c>";
          }
        }
      }
      if (t) {
        var s = e.node.convertToWorldSpaceAR(cc.v2(0, 0));
        s.y += .7 * e.node.height;
        this.ShowTipNode(t, s, n);
      }
    }
  };
  _creator.prototype.ShowTipNode = function (e, t, o, n) {
    var i = this;
    undefined === n && (n = 0);
    if (!this.showTipCd) {
      0 != n && (this.showTipCd = true);
      e = "<outline color=#000000 width=3>" + e + "</outline>";
      this.auto_ui.rtxt_upTipLabel.string = e;
      var a = this.auto_ui.node_upTipNode;
      a.stopAllActions();
      a.opacity = 255;
      a.active = true;
      a.setPosition(a.parent.convertToNodeSpaceAR(t));
      a.children[0].x = 0;
      if (a.x > 215) {
        a.children[0].x = 215 - a.x;
      } else {
        a.x < -215 && (a.children[0].x = -215 - a.x);
      }
      a.runAction(cc.sequence(cc.delayTime(o), cc.fadeOut(.25), cc.callFunc(function () {
        a.active = false;
        i.showTipCd = false;
      })));
    }
  };
  _creator.prototype.CheckGuide = function () {
    var e = this;
    if (PlayerDataManager.PlayerDataMgr.GetGuideIndexByTaskName(Const_Common.GuideName.战斗背包) != Const_Common.GameBagGuideIndex.引导完结) {
      this.auto_ui.btn_VideoGetCell.node.active = false;
      this.auto_ui.btn_zanCunChuBtn.node.active = false;
      this.auto_ui.node_bottomBtn.children.forEach(function (e) {
        return e.scale = 1;
      });
      GameGlobalVariable.GameGlobalVariable.isFirstGuide = true;
    }
    this.scheduleOnce(function () {
      switch (PlayerDataManager.PlayerDataMgr.GetGuideIndexByTaskName(Const_Common.GuideName.战斗背包)) {
        case Const_Common.GameBagGuideIndex.引导初始1:
          e.ShowGuide1();
          break;
        case Const_Common.GameBagGuideIndex.引导拖动水果2:
          e.ShowGuide2();
          break;
        case Const_Common.GameBagGuideIndex.引导刷新按钮3:
          e.ShowGuide3();
          break;
        case Const_Common.GameBagGuideIndex.引导合成4:
          e.ShowGuide4();
          break;
        case Const_Common.GameBagGuideIndex.引导开战6:
          e.ShowGuide6();
          break;
        case Const_Common.GameBagGuideIndex.引导格子8:
          e.ShowGuide8();
          break;
        case Const_Common.GameBagGuideIndex.引导其他水果9:
          e.ShowGuide9();
          break;
        case Const_Common.GameBagGuideIndex.引导结束10:
          e.ShowGuide10();
      }
    });
  };
  _creator.prototype.ShowGuide1 = function () {
    var e = this;
    GuideControl.GuideCtrl.ShowGuide({
      callBack: function () {
        PlayerDataManager.PlayerDataMgr.SetGuideIndex(Const_Common.GuideName.战斗背包, Const_Common.GameBagGuideIndex.引导拖动水果2);
        e.ShowGuide2();
      },
      sayStr: "怪物大军即将到来，赶快布置水果勇士，准备迎战吧！",
      showTipNode: true
    });
    this.auto_ui.node_bottomBtn.active = false;
  };
  _creator.prototype.ShowGuide2 = function () {
    var e = this;
    var t = this;
    this.auto_ui.node_bottomBtn.active = false;
    if (this.equipPool.size > 0) {
      var o = t.auto_ui.node_DragFather.children[0];
      o || this.equipPool.forEach(function (e) {
        o = e.node;
      });
      var n = o.convertToWorldSpaceAR(cc.v2(0, 0));
      var i = t.node.convertToNodeSpaceAR(n);
      GuideControl.GuideCtrl.ShowOneShou({
        parent: this.node,
        isWillClickClose: false,
        x: i.x,
        y: i.y,
        getFingerCallBack: function (e) {
          t.guideShou = e;
          i.x *= -1;
          i.y *= -1;
          i = i.normalizeSelf();
          e.runAction(cc.repeatForever(cc.sequence(cc.moveTo(1.5, e.x + 200 * i.x, e.y + 500 * i.y), cc.moveTo(.02, e.x, e.y))));
        }
      });
      if (!t.selfMap["显示引导2的框"]) {
        t.selfMap["显示引导2的框"] = true;
        GuideControl.GuideCtrl.ShowGuideMaskKuang("将商店中刷新出的装备，放入背包", this.node);
      }
    } else {
      PlayerDataManager.PlayerDataMgr.SetGuideIndex(Const_Common.GuideName.战斗背包, Const_Common.GameBagGuideIndex.引导刷新按钮3);
      var a;
      var r = this;
      r.dressUpEquipMap.forEach(function (e) {
        e.equipData.shuiguoId == Const_Game.FruitId.柠檬精 && (a = e.node);
      });
      if (a) {
        var c = a.convertToWorldSpaceAR(cc.v2(0, 0));
        var s = cc.size(a.width, a.height);
        GuideControl.GuideCtrl.ShowGuide({
          callBack: function () {
            e.auto_ui.node_bottomBtn.active = true;
            e.auto_ui.btn_VideoResetBtn.node.active = false;
            e.auto_ui.btn_start.node.active = false;
            e.auto_ui.btn_ResetBtn.node.active = true;
            e.CheckBottomBtnScale();
            e.auto_ui.btn_ResetBtn.node.children[0].y = -35;
            e.auto_ui.btn_ResetBtn.node.children[1].active = false;
            GuideControl.GuideCtrl.ShowGuide({
              callBack: function () {
                r.CheckGuide();
              },
              sayStr: "刷新商店获得更多水果"
            });
          },
          sayStr: "柠檬精可以提高周围水果属性，尽量挨着摆放~",
          sayNodePos: cc.v2(0, -300),
          wPos: c,
          size: s,
          btnIsMax: true
        });
      }
    }
  };
  _creator.prototype.ShowGuide3 = function () {
    var e = this;
    this.auto_ui.node_bottomBtn.active = true;
    this.auto_ui.btn_VideoResetBtn.node.active = false;
    this.auto_ui.btn_start.node.active = false;
    this.auto_ui.btn_ResetBtn.node.active = true;
    this.CheckBottomBtnScale();
    this.auto_ui.btn_ResetBtn.node.children[0].y = -35;
    this.auto_ui.btn_ResetBtn.node.children[1].active = false;
    this.scheduleOnce(function () {
      var t = e.auto_ui.btn_ResetBtn.node.convertToWorldSpaceAR(cc.v2(0, 0));
      var o = cc.size(e.auto_ui.btn_ResetBtn.node.width, e.auto_ui.btn_ResetBtn.node.height);
      GuideControl.GuideCtrl.ShowGuide({
        callBack: function () {
          e.ResetEquip(true, false, false);
          PlayerDataManager.PlayerDataMgr.SetGuideIndex(Const_Common.GuideName.战斗背包, Const_Common.GameBagGuideIndex.引导合成4);
          e.auto_ui.btn_ResetBtn.node.active = false;
          e.CheckGuide();
          e.auto_ui.btn_ResetBtn.node.children[0].y = -12;
          e.auto_ui.btn_ResetBtn.node.children[1].active = true;
        },
        wPos: t,
        size: o
      });
    });
  };
  _creator.prototype.ShowGuide4 = function () {
    var e = this;
    var t = this;
    this.auto_ui.node_bottomBtn.active = false;
    if (this.equipPool.size > 0) {
      this.guide4Time = -1;
      this.guideSGComp = null;
      this.dressUpEquipMap.forEach(function (e) {
        return e.SetCanClick(false);
      });
      this.equipPool.forEach(function (t) {
        t.SetCanClick(false);
        if (!e.guideSGComp) {
          switch (t.equipData.shuiguoId) {
            case Const_Game.FruitId.毒蘑菇:
              e.guide4Time = 0;
              e.guideSGComp = t;
              t.SetCanClick(true);
              break;
            case Const_Game.FruitId.爆头瓜:
              e.guide4Time = 1;
              e.guideSGComp = t;
              t.SetCanClick(true);
          }
        }
      });
      if (!this.guideSGComp) {
        this.equipPool.forEach(function (t) {
          t.SetCanClick(true);
          e.guideSGComp = t;
        });
        this.guide4Time = 2;
      }
      if (this.guideSGComp) {
        var o;
        this.dressUpEquipMap.forEach(function (t) {
          t.equipData.shuiguoId == e.guideSGComp.equipData.shuiguoId && (o = t.node.convertToWorldSpaceAR(cc.v2(0, 0)));
        });
        var n = this.guideSGComp.node.convertToWorldSpaceAR(cc.v2(0, 0));
        var i = t.node.convertToNodeSpaceAR(n);
        o || this.cellCompMap.forEach(function (e) {
          e.equipComp || (o = e.node.convertToWorldSpaceAR(cc.v2(0, 0)));
        });
        o.x -= n.x;
        o.y -= n.y;
        GuideControl.GuideCtrl.ShowOneShou({
          parent: this.node,
          isWillClickClose: false,
          x: i.x,
          y: i.y,
          getFingerCallBack: function (e) {
            t.guideShou = e;
            e.runAction(cc.repeatForever(cc.sequence(cc.moveTo(1.5, e.x + o.x, e.y + o.y), cc.moveTo(.02, e.x, e.y))));
          }
        });
      }
      if (!t.selfMap["显示引导4的框"]) {
        t.selfMap["显示引导4的框"] = true;
        GuideControl.GuideCtrl.ShowGuideMaskKuang("相同的装备可以合成升级", this.node);
      }
    } else {
      this.ShowGuide4_2();
    }
  };
  _creator.prototype.ShowGuide4_2 = function () {
    var e;
    var t = this;
    t.dressUpEquipMap.forEach(function (t) {
      t.equipData.shuiguoId == Const_Game.FruitId.招财橙子 && (e = t.node);
    });
    if (e) {
      var o = e.convertToWorldSpaceAR(cc.v2(0, 0));
      var n = cc.size(e.width, e.height);
      GuideControl.GuideCtrl.ShowGuide({
        callBack: function () {
          PlayerDataManager.PlayerDataMgr.SetGuideIndex(Const_Common.GuideName.战斗背包, Const_Common.GameBagGuideIndex.引导开战6);
          t.CheckGuide();
        },
        sayStr: "橘子会在每波结束后，额外产出银币",
        sayNodePos: cc.v2(0, 400),
        wPos: o,
        size: n,
        btnIsMax: true
      });
    }
  };
  _creator.prototype.ShowGuide6 = function () {
    var e = this;
    var t = this;
    this.auto_ui.node_bottomBtn.active = true;
    this.auto_ui.btn_ResetBtn.node.active = false;
    this.auto_ui.btn_start.node.active = true;
    t.auto_ui.btn_VideoResetBtn.node.active = false;
    this.CheckBottomBtnScale();
    GuideControl.GuideCtrl.ShowGuide({
      callBack: function () {
        var o = t.auto_ui.btn_start.node.convertToWorldSpaceAR(cc.v2(0, 0));
        var n = cc.size(t.auto_ui.btn_start.node.width, t.auto_ui.btn_start.node.height);
        GuideControl.GuideCtrl.ShowGuide({
          wPos: o,
          size: n,
          callBack: function () {
            t.dressUpEquipMap.forEach(function (e) {
              return e.SetCanClick(true);
            });
            t.equipPool.forEach(function (e) {
              e.SetCanClick(true);
            });
            t.auto_ui.btn_ResetBtn.node.active = true;
            t.auto_ui.btn_start.node.active = true;
            t.auto_ui.btn_VideoResetBtn.node.active = true;
            t.auto_ui.node_bottomBtn.active = true;
            e.CheckBottomBtnScale();
            PlayerDataManager.PlayerDataMgr.SetGuideIndex(Const_Common.GuideName.战斗背包, Const_Common.GameBagGuideIndex.引导词条7);
            t.GameStart();
          }
        });
      },
      sayStr: "已筹备齐全，快让水果勇士们参战吧！"
    });
  };
  _creator.prototype.ShowGuide8 = function () {
    var e = this;
    this.isShow8_1 = false;
    this.equipPool.forEach(function (e) {
      e.isGeZiType || e.SetCanClick(false);
    });
    this.dressUpEquipMap.forEach(function (e) {
      e.SetCanClick(false);
    });
    e.equipPool.forEach(function (t) {
      if (t.isGeZiType) {
        var o = t.node.convertToWorldSpaceAR(cc.v2(0, 0));
        var n = e.node.convertToNodeSpaceAR(o);
        var i = e.node.convertToWorldSpaceAR(cc.v2(0, 0));
        i.x -= o.x;
        i.y -= o.y;
        GuideControl.GuideCtrl.ShowOneShou({
          parent: e.node,
          isWillClickClose: false,
          x: n.x,
          y: n.y,
          getFingerCallBack: function (t) {
            e.guideShou = t;
            t.runAction(cc.repeatForever(cc.sequence(cc.moveTo(1.5, t.x + i.x, t.y + i.y), cc.moveTo(.02, t.x, t.y))));
          }
        });
      }
    });
    GuideControl.GuideCtrl.ShowGuideMaskKuang("出现扩展格子，赶紧将其拖放至相邻的空地处获得更大的空间吧！", this.node);
    this.auto_ui.node_bottomBtn.active = false;
  };
  _creator.prototype.ShowGuide8_1 = function (e) {
    if (!this.isShow8_1) {
      var t = this;
      e.SetCanClick(false);
      GuideControl.GuideCtrl.ShowGuideMaskKuang("可调整格子位置，让摆放更加合理", this.node, 400);
      GuideControl.GuideCtrl.ShowOneShou({
        parent: t.node,
        isWillClickClose: false,
        x: 0,
        y: 0,
        getFingerCallBack: function (e) {
          t.guideShou = e;
          e.runAction(cc.repeatForever(cc.sequence(cc.moveTo(1, -100, 0), cc.moveTo(.2, e.x, e.y))));
        }
      });
      this.cellFatherMove.ShowGuideTween();
    }
  };
  _creator.prototype.ShowGuide8_2 = function () {
    if (PlayerDataManager.PlayerDataMgr.GetGuideIndexByTaskName(Const_Common.GuideName.战斗背包) == Const_Common.GameBagGuideIndex.引导格子8) {
      var e = this;
      this.guideShou && (this.guideShou.active = false);
      this.auto_ui.btn_UseGeZiBtn.interactable = true;
      this.auto_ui.btn_UseGeZiBtn.interactable = true;
      var t = e.auto_ui.btn_UseGeZiBtn.node.convertToWorldSpaceAR(cc.v2(0, 0));
      var o = cc.size(e.auto_ui.btn_UseGeZiBtn.node.width, e.auto_ui.btn_UseGeZiBtn.node.height);
      GuideControl.GuideCtrl.ShowGuide({
        wPos: t,
        size: o,
        callBack: function () {
          e.SetCellFatherMove(false);
          PlayerDataManager.PlayerDataMgr.SetGuideIndex(Const_Common.GuideName.战斗背包, Const_Common.GameBagGuideIndex.引导其他水果9);
          e.CheckGuide();
        }
      });
    }
  };
  _creator.prototype.GuideCheckCell = function (e) {
    var t = GameDataManager.GameDataMgr.gameBag.bagArray;
    var o = false;
    for (var n = 0; n < e.length; n++) {
      var i = e[n].cellData.cellIndex;
      var a = false;
      (i - 1 >= 0 && (i - 1) % this.maxX != this.maxX - 1 && t[i - 1] >= 0 || i - this.maxX >= 0 && t[i - this.maxX] >= 0 || i + 1 < t.length && (i + 1) % this.maxX != 0 && t[i + 1] >= 0 || i + this.maxX < t.length && t[i + this.maxX] >= 0) && (a = true);
      if (a) {
        o = true;
        break;
      }
    }
    return !!o;
  };
  _creator.prototype.ShowGuide9 = function () {
    var e = this;
    e.auto_ui.node_bottomBtn.active = false;
    if (this.equipPool.size > 0) {
      var t = e.auto_ui.node_DragFather.children[0];
      t || this.equipPool.forEach(function (e) {
        t = e.node;
      });
      var o = t.convertToWorldSpaceAR(cc.v2(0, 0));
      var n = e.node.convertToNodeSpaceAR(o);
      GuideControl.GuideCtrl.ShowOneShou({
        parent: this.node,
        isWillClickClose: false,
        x: n.x,
        y: n.y,
        getFingerCallBack: function (t) {
          e.guideShou = t;
          n.x *= -1;
          n.y *= -1;
          n = n.normalizeSelf();
          t.runAction(cc.repeatForever(cc.sequence(cc.moveTo(1.5, t.x + 200 * n.x, t.y + 500 * n.y), cc.moveTo(.02, t.x, t.y))));
        }
      });
    } else {
      PlayerDataManager.PlayerDataMgr.SetGuideIndex(Const_Common.GuideName.战斗背包, Const_Common.GameBagGuideIndex.引导结束10);
      e.CheckGuide();
    }
  };
  _creator.prototype.ShowGuide10 = function () {
    var e = this;
    var t = this;
    this.auto_ui.btn_VideoResetBtn.node.active = true;
    this.auto_ui.btn_ResetBtn.node.active = true;
    this.auto_ui.btn_start.node.active = true;
    t.auto_ui.node_bottomBtn.active = true;
    this.CheckBottomBtnScale();
    var o = t.auto_ui.btn_ResetBtn.node.convertToWorldSpaceAR(cc.v2(0, 0));
    var n = cc.size(t.auto_ui.btn_ResetBtn.node.width, t.auto_ui.btn_ResetBtn.node.height);
    GuideControl.GuideCtrl.ShowGuide({
      callBack: function () {
        t.ResetEquip(false, false, false);
        GuideControl.GuideCtrl.ShowGuide({
          callBack: function () {
            PlayerDataManager.PlayerDataMgr.SetGuideIndex(Const_Common.GuideName.战斗背包, Const_Common.GameBagGuideIndex.引导完结);
            GameGlobalVariable.GameGlobalVariable.setNewGame();
            e.auto_ui.btn_VideoGetCell.node.active = true;
            e.scheduleOnce(function () {
              e.CheckBottomBtnScale();
            }, .15);
          },
          sayStr: "充分利用安排空地，做一个整理大师吧！"
        });
      },
      sayStr: "使用银币刷新商店，获得更多水果加强实力",
      wPos: o,
      size: n
    });
  };
  _creator.prototype.CheckUpBuff = function (e, t, o, n) {
    var i = this;
    if (!this.isUpBuffCdTime && e && 0 != e.length) {
      this.isUpBuffCdTime = true;
      if (t) {
        this.scheduleOnce(function () {
          i.isUpBuffCdTime = false;
        }, .2);
      } else {
        this.scheduleOnce(function () {
          i.isUpBuffCdTime = false;
        });
      }
      var a = this.JustCheck(e, o);
      var r = [];
      var c = [];
      a.forEach(function (e) {
        var t = i.cellCompMap.get(e);
        if (t && t.equipComp) {
          var o = Excel.Excel.shuiguo(t.equipComp.equipData.shuiguoId);
          if (5 != o.attackstate && 8 != o.attackstate && 9 != o.attackstate && -1 == r.indexOf(t.equipComp)) {
            r.push(t.equipComp);
            c.push(t.equipComp.node);
          }
        }
      });
      if (c.length > 0) {
        if (t) {
          this.ShowBuff(c);
        } else {
          this.ShowJianTou(c, n);
        }
      }
    }
  };
  _creator.prototype.JustCheck = function (e, t) {
    var o = [];
    var n = GameDataManager.GameDataMgr.gameBag.bagArray;
    if (t == Const_Game.BuffCheckType.正四方) {
      for (var i = 0; i < e.length; i++) {
        if ((r = e[i]) - 1 >= 0 && (r - 1) % this.maxX != this.maxX - 1 && n[r - 1] > 0) {
          var a = r - 1;
          -1 == o.indexOf(a) && -1 == e.indexOf(a) && o.push(a);
        }
        if (r - this.maxX >= 0 && n[r - this.maxX] > 0) {
          a = r - this.maxX;
          -1 == o.indexOf(a) && -1 == e.indexOf(a) && o.push(a);
        }
        if (r + 1 < n.length && (r + 1) % this.maxX != 0 && n[r + 1] > 0) {
          a = r + 1;
          -1 == o.indexOf(a) && -1 == e.indexOf(a) && o.push(a);
        }
        if (r + this.maxX < n.length && n[r + this.maxX] > 0) {
          a = r + this.maxX;
          -1 == o.indexOf(a) && -1 == e.indexOf(a) && o.push(a);
        }
      }
    } else if (t == Const_Game.BuffCheckType.同行) {
      for (i = 0; i < e.length; i++) {
        var r = e[i];
        for (var c = 1; c < this.maxX; c++) {
          var s = r - c;
          (l = Math.floor(s / this.maxX)) == Math.floor(r / this.maxX) && n[s] > 0 && -1 == o.indexOf(s) && -1 == e.indexOf(s) && o.push(s);
        }
        for (c = 1; c < this.maxX; c++) {
          s = r + c;
          (l = Math.floor(s / this.maxX)) == Math.floor(r / this.maxX) && n[s] > 0 && -1 == o.indexOf(s) && -1 == e.indexOf(s) && o.push(s);
        }
      }
    } else if (t == Const_Game.BuffCheckType.同列) {
      for (i = 0; i < e.length; i++) {
        var u = (r = e[i]) % this.maxX;
        for (var l = 1; l < this.maxY && !((s = r - this.maxX * l) < 0); l++) {
          (c = s % this.maxX) == u && n[s] > 0 && -1 == o.indexOf(s) && -1 == e.indexOf(s) && o.push(s);
        }
        for (l = 1; l < this.maxY && !((s = r + this.maxX * l) >= this.maxX * this.maxY); l++) {
          (c = s % this.maxX) == u && n[s] > 0 && -1 == o.indexOf(s) && -1 == e.indexOf(s) && o.push(s);
        }
      }
    } else if (t == Const_Game.BuffCheckType.正上下) {
      for (i = 0; i < e.length; i++) {
        u = (r = e[i]) % this.maxX;
        (s = r - this.maxX) >= 0 && (c = s % this.maxX) == u && n[s] > 0 && -1 == o.indexOf(s) && -1 == e.indexOf(s) && o.push(s);
        (s = r + this.maxX) < this.maxX * this.maxY && (c = s % this.maxX) == u && n[s] > 0 && -1 == o.indexOf(s) && -1 == e.indexOf(s) && o.push(s);
      }
    }
    return o;
  };
  _creator.prototype.ShowBuff = function (e) {
    for (var t = 0; t < e.length; t++) {
      var o = e[t];
      this.ShowOneUpBuff(o.convertToWorldSpaceAR(cc.v2(0, 0)));
    }
  };
  _creator.prototype.ShowOneUpBuff = function (e) {
    var t;
    var o = this;
    (t = this.upBuffArray.length > 0 ? this.upBuffArray.shift() : cc.instantiate(this.auto_ui.node_upBuffEffect)).parent = this.auto_ui.node_upBuffFather;
    t.setPosition(t.parent.convertToNodeSpaceAR(e));
    t.active = true;
    t.getChildByName("1").getComponent(cc.ParticleSystem).resetSystem();
    t.getChildByName("3").getComponent(cc.ParticleSystem).resetSystem();
    this.scheduleOnce(function () {
      o.RemoveOneUpBuff(t);
    }, 2);
  };
  _creator.prototype.RemoveOneUpBuff = function (e) {
    e.removeFromParent();
    e.active = false;
    this.upBuffArray.push(e);
  };
  _creator.prototype.ShowJianTou = function (e, t) {
    this.HideJianTou();
    for (var o = 0; o < e.length; o++) {
      var n = e[o].convertToWorldSpaceAR(cc.v2(0, 0));
      var i = undefined;
      if (o < this.jianTouArray.length) {
        i = this.jianTouArray[o];
      } else {
        (i = cc.instantiate(this.auto_ui.node_jiantou)).parent = this.auto_ui.node_upBuffFather;
        i.active = true;
        i.children[0].runAction(cc.repeatForever(cc.sequence(cc.moveTo(.75, 0, 30), cc.moveTo(.75, 0, 0))));
        this.jianTouArray.push(i);
      }
      i.active = true;
      i.setPosition(i.parent.convertToNodeSpaceAR(n));
      var a = i.getComponentInChildren(cc.Label);
      if (a) {
        if (0 == t) {
          a.string = "攻击力";
        } else {
          1 == t && (a.string = "暴击率");
        }
      }
    }
  };
  _creator.prototype.HideJianTou = function () {
    this.jianTouArray.forEach(function (e) {
      return e.active = false;
    });
  };
  _creator.prototype.CheckBottomBtnScale = function () { };
  _creator.prototype.BagShowUnLock5Tip = function (e) {
    if (!e.isGeZiType && e.equipData.equipLevel == GameGlobalVariable.GameGlobalVariable.normalMaxLevel - 1) {
      var t;
      var o = Logic_GetEquip.default.I.GetZaZhongId(e.equipData.shuiguoId);
      var n = false;
      var i = e.node.convertToWorldSpaceAR(cc.v2(0, 0));
      this.equipPool.forEach(function (e) {
        if (e.equipData.shuiguoId == o && e.equipData.equipLevel == GameGlobalVariable.GameGlobalVariable.normalMaxLevel - 1) {
          t = e.node.convertToWorldSpaceAR(cc.v2(0, 0));
          cc.Vec2.distance(i, t) < 100 && (n = true);
        }
      });
      n || this.dressUpEquipMap.forEach(function (e) {
        if (e.equipData.shuiguoId == o && e.equipData.equipLevel == GameGlobalVariable.GameGlobalVariable.normalMaxLevel - 1) {
          t = e.node.convertToWorldSpaceAR(cc.v2(0, 0));
          cc.Vec2.distance(i, t) < 100 && (n = true);
        }
      });
      if (n) {
        var a = Excel.Excel.shuiguo(e.equipData.shuiguoId);
        var r = Excel.Excel.shuiguo(o);
        var c = null;
        if (a && 0 != a.jinjieShuiGuoId && PlayerDataManager.PlayerDataMgr.GetEquipDataById(a.id).level < a.jinJieLv) {
          c = a.name + "外围养成至" + a.jinJieLv + "级解锁杂交";
        } else {
          r && 0 != r.jinjieShuiGuoId && PlayerDataManager.PlayerDataMgr.GetEquipDataById(r.id).level < r.jinJieLv && (c = r.name + "外围养成至" + r.jinJieLv + "级解锁杂交");
        }
        if (c) {
          var s = new Const_Common.EventViewOpenData();
          s.tipStr = c;
          s.titleStr = "条件不足";
          UIManager.default.open(BundleConfig.BundleNames.Common, UIConfig_Common.UIView_Common.UI_EventView, s);
        }
      }
    }
  };
  _creator.prototype.ShowOneLevel5Tip = function (e, t) {
    if (Logic_GetEquip.default.I.GetMaxLevel(e) == GameGlobalVariable.GameGlobalVariable.zaZhongMaxLevel) {
      var o = Logic_GetEquip.default.I.GetZaZhongId(e);
      if (-1 != o) {
        var n = null;
        this.dressUpEquipMap.forEach(function (e) {
          n || e.equipData.shuiguoId != o || e.equipData.equipLevel != GameGlobalVariable.GameGlobalVariable.normalMaxLevel - 1 || (n = e);
        });
        n || this.equipPool.forEach(function (e) {
          n || e.equipData.shuiguoId != o || e.equipData.equipLevel != GameGlobalVariable.GameGlobalVariable.normalMaxLevel - 1 || (n = e);
        });
        !n && this.currZanCunChuEquip && (n || this.currZanCunChuEquip.equipData.shuiguoId != o || this.currZanCunChuEquip.equipData.equipLevel != GameGlobalVariable.GameGlobalVariable.normalMaxLevel - 1 || (n = this.currZanCunChuEquip));
        if (n && this.lineTipControl.ShowOneLine(t.node, n.node, e, o)) {
          t.ShowKuangTip(true);
          n.ShowKuangTip(true);
        }
      }
    }
  };
  _creator.prototype.AICheck = function () {
    var e = this;
    AIControl.default._instance.isOpen && this.scheduleOnce(function () {
      var t = e;
      if (e.auto_ui.node_bottomBtn.active) {
        if (e.GetCanDressUpCell()) {
          e.auto_ui.node_bottomBtn.active && e.SetCellFatherMove(true);
          e.SetTouchStartNode(e.aiPickEquip.node);
          var o = e.aiPickCell[0].node.convertToWorldSpaceAR(cc.v2(0, 0));
          var n = e.aiPickEquip.GetGeZi().children[0].convertToWorldSpaceAR(cc.v2(0, 0));
          n = cc.v2(o.x - n.x, o.y - n.y);
          e.aiPickEquip.node.runAction(cc.sequence(cc.moveTo(AIControl.default._instance.dragTime, e.aiPickEquip.node.x + n.x, e.aiPickEquip.node.y + n.y), cc.callFunc(function () {
            e.moveLength = 1e3;
            e.onChildTouchUp();
          })));
        } else if (e.GetUpLevelEquip() || e.GetLevelLowSelf()) {
          e.SetTouchStartNode(e.aiPickEquip.node);
          if (e.aiPickOtherEquip.lockCellArray && e.aiPickOtherEquip.lockCellArray.length > 0) {
            var i = e.aiPickOtherEquip.node.convertToWorldSpaceAR(cc.v2(0, 0));
            n = e.aiPickEquip.GetGeZi().children[0].convertToWorldSpaceAR(cc.v2(0, 0));
            n = cc.v2(i.x - n.x, i.y - n.y);
            e.aiPickEquip.node.runAction(cc.sequence(cc.moveTo(AIControl.default._instance.dragTime, e.aiPickEquip.node.x + n.x, e.aiPickEquip.node.y + n.y), cc.callFunc(function () {
              e.moveLength = 1e3;
              e.onChildTouchUp();
            })));
          } else {
            e.scheduleOnce(function () {
              var t = e.aiPickOtherEquip.node.convertToWorldSpaceAR(cc.v2(0, 0));
              var o = e.aiPickEquip.GetGeZi().children[0].convertToWorldSpaceAR(cc.v2(0, 0));
              o = cc.v2(t.x - o.x, t.y - o.y);
              e.aiPickEquip.node.runAction(cc.sequence(cc.moveTo(AIControl.default._instance.dragTime, e.aiPickEquip.node.x + o.x, e.aiPickEquip.node.y + o.y), cc.callFunc(function () {
                e.moveLength = 1e3;
                e.onChildTouchUp();
              })));
            });
          }
        } else if (e.GetEquipCanDressUp()) {
          e.SetTouchStartNode(e.aiPickEquip.node);
          o = e.aiPickCell[0].node.convertToWorldSpaceAR(cc.v2(0, 0));
          n = e.aiPickEquip.GetGeZi().children[0].convertToWorldSpaceAR(cc.v2(0, 0));
          n = cc.v2(o.x - n.x, o.y - n.y);
          e.aiPickEquip.node.runAction(cc.sequence(cc.moveTo(AIControl.default._instance.dragTime, e.aiPickEquip.node.x + n.x, e.aiPickEquip.node.y + n.y), cc.callFunc(function () {
            e.moveLength = 1e3;
            e.onChildTouchUp();
          })));
        } else if (e.GetCanResetEquipPool()) {
          AIControl.default._instance.ShowClickBtn(e.auto_ui.btn_ResetBtn.node, function () {
            t.SliderResetClick();
            t.AICheck();
          });
        } else if (e.GetCanVideoResetEquipPool()) {
          AIControl.default._instance.ShowClickBtn(e.auto_ui.btn_VideoResetBtn.node, function () {
            t.ResetEquip(false, true, false);
            t.auto_ui.btn_VideoResetBtn.node.active = false;
            t.AICheck();
          });
        } else if (e.CheckIsBigLevel()) {
          AIControl.default._instance.ShowClickBtn(e.auto_ui.btn_ResetBtn.node, function () {
            t.SliderResetClick();
          });
        } else {
          AIControl.default._instance.ShowClickBtn(e.auto_ui.btn_start.node, function () {
            t.GameStart();
          });
        }
      } else {
        AIControl.default._instance.ShowClickBtn(e.auto_ui.btn_UseGeZiBtn.node, function () {
          t.SetCellFatherMove(false);
          t.AICheck();
        });
      }
    }, AIControl.default._instance.aiCDTime);
  };
  _creator.prototype.GetCanDressUpCell = function () {
    this.aiPickEquip = null;
    this.aiPickCell = null;
    var e = false;
    this.equipPool && this.equipPool.size > 0 && this.equipPool.forEach(function (t) {
      t.isGeZiType && (e = true);
    });
    if (!e) {
      return false;
    }
    if (this.equipPool && this.equipPool.size > 0) {
      var t = null;
      this.equipPool.forEach(function (e) {
        e.isGeZiType && !t && (t = e);
      });
      if (t) {
        var o = [];
        var n = false;
        var i = null;
        t.GetGeZi().children.forEach(function (e) {
          if (i) {
            o.push(cc.v2(e.x - i.x, e.y - i.y));
          } else {
            i = e.getPosition();
            o.push(cc.v2(0, 0));
          }
        });
        var a = function (e) {
          var i = r.baseCellCompArray[e];
          var a = [];
          o.forEach(function (e) {
            a.push(cc.v2(i.node.x + e.x, i.node.y + e.y));
          });
          n = true;
          var c = [];
          for (var s = 0; s < a.length; s++) {
            var u = a[s];
            var l = false;
            for (var p = 0; p < r.baseCellCompArray.length; p++) {
              var h = r.baseCellCompArray[p].node.getPosition();
              if (cc.Vec2.distance(u, h) < 10 && -1 == GameDataManager.GameDataMgr.gameBag.bagArray[r.baseCellCompArray[p].cellData.cellIndex]) {
                l = true;
                c.push(r.baseCellCompArray[p]);
              }
            }
            if (!l) {
              n = false;
              break;
            }
          }
          if (n) {
            var f = [];
            c.forEach(function (e) {
              return f.push(e.cellData.cellIndex);
            });
            if (r.CheckOneCellArrayIsOk(f, GameDataManager.GameDataMgr.gameBag.bagArray)) {
              r.aiPickEquip = t;
              r.aiPickCell = c;
              return "break";
            }
          }
        };
        var r = this;
        for (var c = 0; c < this.baseCellCompArray.length && "break" !== a(c); c++) {
          ;
        }
        if (this.aiPickCell && this.aiPickEquip) {
          return true;
        }
      }
    }
    return false;
  };
  _creator.prototype.GetUpLevelEquip = function () {
    this.aiPickEquip = null;
    this.aiPickCell = null;
    var e = null;
    var t = null;
    var o = [];
    var n = [];
    this.equipPool.forEach(function (e) {
      return o.push(e);
    });
    this.dressUpEquipMap.forEach(function (e) {
      return n.push(e);
    });
    for (var i = 0; i < o.length; i++) {
      var a = o[i];
      if (!e) {
        for (var r = i + 1; r < o.length; r++) {
          if (a != (c = o[r]) && a.equipData.equipLevel == c.equipData.equipLevel && a.equipData.shuiguoId == c.equipData.shuiguoId) {
            e = a;
            t = c;
            break;
          }
        }
      }
      if (!e) {
        for (r = 0; r < n.length; r++) {
          if (a != (c = n[r]) && a.equipData.equipLevel == c.equipData.equipLevel && a.equipData.shuiguoId == c.equipData.shuiguoId) {
            e = a;
            t = c;
            break;
          }
        }
      }
    }
    if (e && t) {
      this.aiPickEquip = e;
      this.aiPickOtherEquip = t;
      return true;
    }
    for (i = 0; i < n.length; i++) {
      a = n[i];
      if (!e) {
        for (r = i + 1; r < n.length; r++) {
          var c;
          if (a != (c = n[r]) && a.equipData.equipLevel == c.equipData.equipLevel && a.equipData.equipLevel < Logic_GetEquip.default.I.GetMaxLevel(a.equipData.shuiguoId)) {
            if (a.equipData.shuiguoId == c.equipData.shuiguoId && a.equipData.equipLevel < GameGlobalVariable.GameGlobalVariable.normalMaxLevel - 1) {
              e = a;
              t = c;
              break;
            }
            if (a.equipData.equipLevel == GameGlobalVariable.GameGlobalVariable.normalMaxLevel - 1 && Logic_GetEquip.default.I.GetZaZhongId(a.equipData.shuiguoId) == c.equipData.shuiguoId) {
              e = a;
              t = c;
              break;
            }
          }
        }
      }
    }
    return !(!e || !t || (this.aiPickEquip = e, this.aiPickOtherEquip = t, 0));
  };
  _creator.prototype.GetLevelLowSelf = function () {
    this.aiPickEquip = null;
    this.aiPickCell = null;
    var e = null;
    var t = null;
    var o = [];
    var n = [];
    this.equipPool.forEach(function (e) {
      return o.push(e);
    });
    this.dressUpEquipMap.forEach(function (e) {
      return n.push(e);
    });
    for (var i = 0; i < o.length; i++) {
      var a = o[i];
      if (a.equipData.equipLevel > 0) {
        for (var r = 0; r < n.length; r++) {
          var c = n[r];
          if (c.equipData.shuiguoId == a.equipData.shuiguoId && c.equipData.equipLevel < a.equipData.equipLevel) {
            e = a;
            t = c;
            break;
          }
        }
      }
    }
    return !(!e || !t || (this.aiPickEquip = e, this.aiPickOtherEquip = t, 0));
  };
  _creator.prototype.GetEquipCanDressUp = function () {
    this.aiPickEquip = null;
    this.aiPickCell = null;
    if (this.equipPool && this.equipPool.size > 0) {
      var t = null;
      var o = [];
      this.equipPool.forEach(function (e) {
        o.push(e);
      });
      o.sort(function (e, t) {
        return t.equipData.equipLevel - e.equipData.equipLevel;
      });
      var n = this.auto_ui.node_cubeFather;
      var i = function (e) {
        t = o[e];
        var i = [];
        var r = false;
        var c = null;
        t.GetGeZi().children.forEach(function (e) {
          if (c) {
            i.push(cc.v2(e.x - c.x, e.y - c.y));
          } else {
            c = e.getPosition();
            i.push(cc.v2(0, 0));
          }
        });
        var s = function (e) {
          var o = n.children[e];
          var c = [];
          i.forEach(function (e) {
            c.push(cc.v2(o.x + e.x, o.y + e.y));
          });
          r = true;
          var s = [];
          for (var u = 0; u < c.length; u++) {
            var p = c[u];
            var h = false;
            for (var f = 0; f < n.children.length; f++) {
              var g = n.children[f].getPosition();
              var _ = n.children[f].getComponent(Item_GameBagCell.default);
              if (cc.Vec2.distance(p, g) < 10 && 0 == GameDataManager.GameDataMgr.gameBag.bagArray[_.cellData.cellIndex]) {
                h = true;
                s.push(_);
              }
            }
            if (!h) {
              r = false;
              break;
            }
          }
          if (r) {
            a.aiPickEquip = t;
            a.aiPickCell = s;
            return "break";
          }
        };
        for (var u = 0; u < n.children.length && "break" !== s(u); u++) {
          ;
        }
        if (a.aiPickCell && a.aiPickEquip) {
          return {
            value: true
          };
        }
      };
      var a = this;
      for (var r = 0; r < o.length; r++) {
        var c = i(r);
        if ("object" == typeof c) {
          return c.value;
        }
      }
    }
    return false;
  };
  _creator.prototype.GetCanResetEquipPool = function () {
    return GameDataManager.GameDataMgr.gameBag.silverCoin >= this.oneBuyMoney;
  };
  _creator.prototype.GetCanVideoResetEquipPool = function () {
    return this.auto_ui.btn_VideoResetBtn.node.active;
  };
  _creator.prototype.CheckIsBigLevel = function () {
    if (GameGlobalVariable.GameGlobalVariable.nowlevel) {
      var e = Excel.Excel.shuiguoguanqia(GameGlobalVariable.GameGlobalVariable.nowlevel).levelboshuid.length;
      var t = GameDataManager.GameDataMgr.getNowLevelBoshuState(GameGlobalVariable.GameGlobalVariable.nowlevel, 2) + 1;
      LogManager.LogMgr.debug("maxBoShu:", e, "boshu:", t);
      var o = 0;
      if (e <= 10) {
        if (4 == t) {
          o = 5;
        } else if (7 == t) {
          o = 10;
        } else {
          10 == t && (o = 20);
        }
      } else if (e <= 15) {
        if (5 == t) {
          o = 5;
        } else if (10 == t) {
          o = 10;
        } else {
          15 == t && (o = 20);
        }
      } else if (5 == t) {
        o = 5;
      } else if (10 == t) {
        o = 10;
      } else {
        20 == t && (o = 20);
      }
      if (0 != o) {
        if (-1 == this.mustResetTime) {
          this.mustResetTime = 0;
          return true;
        }
        if (this.mustResetTime >= o) {
          this.mustResetTime = -1;
          return false;
        }
      }
    }
    return false;
  };
  __decorate([_property(UI_Bag_UIBindings.default)], _creator.prototype, "auto_ui", undefined);
  __decorate([_property(cc.Prefab)], _creator.prototype, "paiZiPfb", undefined);
  __decorate([_property(LineTipControl.default)], _creator.prototype, "lineTipControl", undefined);
  __decorate([_property(CPBuffControl.default)], _creator.prototype, "cpBuffControl", undefined);
  return __decorate([_ccclass], _creator);
}(UIView.default);
exports.default = _def_UI_Bag;